Questionnaire fixes: correct bridge/final wording, add response validation, capitalize partner label, new future-outlook page
Browse files- Fix show_coins_bridge()'s text to actually drop the experimenter mention (docstring
already claimed this but the markdown still had it); reword the true final screen to
"Completed! Please let your experimenter know you're ready." so only that screen
mentions the experimenter.
- Remove misleading "Last question"/"One more question" headers from the strategy and
belief-check pages.
- Require an actual response on every questionnaire page before Continue appears
(sliders must be touched, free text must be non-blank), matching the existing
belief-check gating.
- Capitalize "your partner (#ID)" to "YOUR PARTNER (#ID)" in the Motivation/Effort
pages, matching the existing "YOURSELF" capitalization.
- Add a new final page with 3 future-outlook items (5-point agreement scale).
Files changed (3)
194 unmodified lines195196197194 unmodified lines- New `show_coins_bridge()`: shown once, right when the Questionnaire stage is reached (works whether or not Practice/Quiz/Explore were skipped via `?dev=1&start=...`). Shows the same "Adventure Complete!" image + coin totals for self/partner as before, but the closing line changed from "Please let your experimenter know you're done." to "Please answer a couple more questions about the game, then let your experimenter know once you're done." — no "let experimenter" line here; that moved to the new final screen. Has its own "Continue" button gating entry into the questionnaire.- `finish_experiment()` (now the true end-of-session screen, reached only after the questionnaire completes): dropped the now-duplicated coin-totals display (already shown on the bridge screen above) and the final line changed from "You completed the game. Great job! Please let your experimenter know you're done." to "You're all done! Great job! Please let your experimenter know you're finished." (Prolific completion-button branch unchanged, just reworded its adjacent line to "You're all done — thank you!").- `?dev=1&start=questionnaire` now exercises the full new sequence (bridge screen → questionnaire → final screen) since the bridge is tied to reaching the Questionnaire stage rather than a separate dev flag.194 unmodified lines195196197198199200201202203204205206207208209210211212213214215216217218219220221194 unmodified lines- New `show_coins_bridge()`: shown once, right when the Questionnaire stage is reached (works whether or not Practice/Quiz/Explore were skipped via `?dev=1&start=...`). Shows the same "Adventure Complete!" image + coin totals for self/partner as before, but the closing line changed from "Please let your experimenter know you're done." to "Please answer a couple more questions about the game, then let your experimenter know once you're done." — no "let experimenter" line here; that moved to the new final screen. Has its own "Continue" button gating entry into the questionnaire.- `finish_experiment()` (now the true end-of-session screen, reached only after the questionnaire completes): dropped the now-duplicated coin-totals display (already shown on the bridge screen above) and the final line changed from "You completed the game. Great job! Please let your experimenter know you're done." to "You're all done! Great job! Please let your experimenter know you're finished." (Prolific completion-button branch unchanged, just reworded its adjacent line to "You're all done — thank you!").- `?dev=1&start=questionnaire` now exercises the full new sequence (bridge screen → questionnaire → final screen) since the bridge is tied to reaching the Questionnaire stage rather than a separate dev flag.---## 2026-08-04 — Bridge screen still said "let experimenter" too early; fixed wording on both screensThe first pass above left an inconsistency: `show_coins_bridge()`'s docstring said "no 'let experimenter know' here" but its actual markdown text still included "...then let your experimenter know once you're done." Corrected:- `show_coins_bridge()`: closing line simplified to "Please answer a couple more questions about the game you just played." — no experimenter mention here at all now.- `finish_experiment()` (the true final screen, non-Prolific branch): reworded from "You're all done! Great job! Please let your experimenter know you're finished." to "Completed! Please let your experimenter know you're ready." — this is now the only screen that mentions the experimenter.---## 2026-08-04 — Questionnaire: removed misleading headers, added response-required gating, capitalized "your partner", new future-outlook page**File:** `questionnaires.py`- Removed the "Last question" header from the strategy free-text page (it isn't the last question — several pages follow) and the "One more question" header from the belief-check page. Both pages now show no header at all.- Every page in the questionnaire now requires an actual response before Continue appears: sliders must each be touched at least once (or already have a value from a previous pass, e.g. after Back); the free-text page requires non-blank text; the new agreement-scale page (below) requires every item answered. The belief-check page already worked this way (Submit-then-Continue).- `_partner_label()` gained a `caps` option; the Motivation/Effort pages now use `_partner_label(caps=True)` so "your partner (#1234)" reads "YOUR PARTNER (#1234)", matching the existing "YOURSELF" capitalization convention. The hypothetical-battery's third-person "their partner" phrasing was left as-is (different wording, not requested).- New page added at the very end of the questionnaire (after the hypothetical-parent/child battery, before the questionnaire completes): "About your outlook on the future" — a 5-point agreement scale (Strongly disagree…Strongly agree) for three items:- "When I think about my future, I can see clearly what I want to achieve." (`future_clear_goal`)- "I can imagine what my future will be like." (`future_imagine`)- "I can't get a clear picture of my future even when I try." (`future_unclear`)New `_likert_page()` primitive added alongside the existing `_slider_page`/`_text_page`/`_belief_page`. No `export_csv.py` changes needed — the questionnaire stage's whole answers dict is already exported as a JSON blob, so these three keys flow through automatically.
34 unmodified lines3536373839404142434417 unmodified lines62636465666768697071727374757 unmodified lines83848586878889909192939495969798991001011021031041051061071081093 unmodified lines11311411511611711811923 unmodified lines1431441451461471481492 unmodified lines15215315415515615715840 unmodified lines19920020120220320434 unmodified linesreturn FeedbackStage(name=name, display_fn=display_fn, custom_key_press_fn=_ignore_keys)def _partner_label():pid = app.storage.user.get("partner_id") or orders.partner_id_for(app.storage.user.get("pid", "") or "0001")return f"your partner (#{pid})"def _hypothetical_person(titlecase=False):17 unmodified linesdef _slider_page(title, intro, items, lo_label=None, hi_label=None, lo=0, hi=100, start=50):"""items: list of (key, prompt) sharing lo_label/hi_label, or(key, prompt, item_lo_label, item_hi_label) to override the anchors for that one item."""async def render(container, answers, can_back):nicewebrl.clear_element(container)result = {"action": None}ev = asyncio.Event()sliders = {}with container.style("align-items:center; max-width:680px;"):ui.markdown(f"## {title}")if intro:ui.markdown(intro)for item in items:7 unmodified linesui.label(item_lo).style("font-size:12px; color:#666;")ui.label(item_hi).style("font-size:12px; color:#666;")sliders[key] = s_nav_row(result, ev, can_back)await ev.wait()return result["action"], {k: int(s.value) for k, s in sliders.items()}return renderdef _text_page(title, prompt, key):async def render(container, answers, can_back):nicewebrl.clear_element(container)result = {"action": None}ev = asyncio.Event()with container.style("align-items:center; max-width:640px;"):ui.markdown(f"## {title}")ui.markdown(prompt)area = ui.textarea(value=answers.get(key, "")).props("outlined autogrow").style("width:100%;")_nav_row(result, ev, can_back)await ev.wait()return result["action"], {key: (area.value or "").strip()}return renderdef _belief_page():"""Manipulation check: did they believe the partner's payout was real? Answering locks theoptions (matching the original design), but Back still lets them revisit and re-answer."""3 unmodified linesresult = {"action": None}ev = asyncio.Event()with container.style("align-items:center; max-width:640px;"):ui.markdown("## One more question")ui.markdown("Did you believe that the other person would receive the money you ""earned for them?"23 unmodified linesdef post_game_questionnaire_stage():async def _display(stage, container):p = _partner_label()who = _hypothetical_person()who_title = _hypothetical_person(titlecase=True)hyp_intro = (2 unmodified lines)pages = [_text_page("Last question", "What strategy (or strategies) did you use during ""the learning task?", "strategy_text"),_slider_page("Motivation", "Think back to the task you just completed.",40 unmodified lines"Very easy", "Very difficult"),("hyp_interest", f"How boring or interesting do you think {who} would find the task?","Very boring", "Very interesting")]),]answers = {}34 unmodified lines3536373839404142434417 unmodified lines6263646566676869707172737475767778797 unmodified lines878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631643 unmodified lines16816917017117217323 unmodified lines1971981992002012022032 unmodified lines20620720820921021121240 unmodified lines25325425525625725825926026126226326426534 unmodified linesreturn FeedbackStage(name=name, display_fn=display_fn, custom_key_press_fn=_ignore_keys)def _partner_label(caps=False):pid = app.storage.user.get("partner_id") or orders.partner_id_for(app.storage.user.get("pid", "") or "0001")return f"YOUR PARTNER (#{pid})" if caps else f"your partner (#{pid})"def _hypothetical_person(titlecase=False):17 unmodified linesdef _slider_page(title, intro, items, lo_label=None, hi_label=None, lo=0, hi=100, start=50):"""items: list of (key, prompt) sharing lo_label/hi_label, or(key, prompt, item_lo_label, item_hi_label) to override the anchors for that one item.Continue stays hidden until every slider has been touched at least once (or was alreadyanswered on an earlier pass through this page, e.g. after Back)."""async def render(container, answers, can_back):nicewebrl.clear_element(container)result = {"action": None}ev = asyncio.Event()sliders = {}touched = {item[0]: (item[0] in answers) for item in items}with container.style("align-items:center; max-width:680px;"):if title:ui.markdown(f"## {title}")if intro:ui.markdown(intro)for item in items:7 unmodified linesui.label(item_lo).style("font-size:12px; color:#666;")ui.label(item_hi).style("font-size:12px; color:#666;")sliders[key] = scont = _nav_row(result, ev, can_back)def mark(key):touched[key] = Truecont.set_visibility(all(touched.values()))for key, s in sliders.items():s.on_value_change(lambda e, k=key: mark(k))cont.set_visibility(all(touched.values()))await ev.wait()return result["action"], {k: int(s.value) for k, s in sliders.items()}return renderdef _text_page(title, prompt, key):"""Continue stays hidden until the textarea has non-blank content."""async def render(container, answers, can_back):nicewebrl.clear_element(container)result = {"action": None}ev = asyncio.Event()with container.style("align-items:center; max-width:640px;"):if title:ui.markdown(f"## {title}")ui.markdown(prompt)area = ui.textarea(value=answers.get(key, "")).props("outlined autogrow").style("width:100%;")cont = _nav_row(result, ev, can_back)def check():cont.set_visibility(bool((area.value or "").strip()))area.on_value_change(lambda e: check())check()await ev.wait()return result["action"], {key: (area.value or "").strip()}return renderLIKERT5 = ["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"]def _likert_page(title, intro, items, options=LIKERT5):"""items: list of (key, prompt). One radio group per item. Continue stays hidden untilevery item has an answer."""async def render(container, answers, can_back):nicewebrl.clear_element(container)result = {"action": None}ev = asyncio.Event()radios = {}with container.style("align-items:center; max-width:680px;"):if title:ui.markdown(f"## {title}")if intro:ui.markdown(intro)for key, prompt in items:with ui.column().style("width:100%; max-width:600px; margin-bottom:16px;"):ui.markdown(f"**{prompt}**")radios[key] = ui.radio({o: o for o in options}, value=answers.get(key)).props("inline color=primary")cont = _nav_row(result, ev, can_back)def check():cont.set_visibility(all(r.value is not None for r in radios.values()))for r in radios.values():r.on_value_change(lambda e: check())check()await ev.wait()return result["action"], {k: r.value for k, r in radios.items()}return renderdef _belief_page():"""Manipulation check: did they believe the partner's payout was real? Answering locks theoptions (matching the original design), but Back still lets them revisit and re-answer."""3 unmodified linesresult = {"action": None}ev = asyncio.Event()with container.style("align-items:center; max-width:640px;"):ui.markdown("Did you believe that the other person would receive the money you ""earned for them?"23 unmodified linesdef post_game_questionnaire_stage():async def _display(stage, container):p = _partner_label(caps=True)who = _hypothetical_person()who_title = _hypothetical_person(titlecase=True)hyp_intro = (2 unmodified lines)pages = [_text_page(None, "What strategy (or strategies) did you use during ""the learning task?", "strategy_text"),_slider_page("Motivation", "Think back to the task you just completed.",40 unmodified lines"Very easy", "Very difficult"),("hyp_interest", f"How boring or interesting do you think {who} would find the task?","Very boring", "Very interesting")]),_likert_page("About your outlook on the future","Please indicate how much you agree with each statement below.",[("future_clear_goal", "When I think about my future, I can see clearly what ""I want to achieve."),("future_imagine", "I can imagine what my future will be like."),("future_unclear", "I can't get a clear picture of my future even when I try.")]),]answers = {}
787 unmodified lines78878979079179279379479579679780 unmodified lines878879880881882883884787 unmodified linesf"### You collected **{partner_pts} coins** for your partner (**#{partner}**) → "f"we will send them a bonus of **${to_money(partner_pts):.2f}**!")ui.markdown("### Please answer a couple more questions about the game, ""then let your experimenter know once you're done.")ev = asyncio.Event()ui.button("Continue", on_click=ev.set).props("color=primary size=lg")await ev.wait()80 unmodified lineselse:ui.markdown("### You're all done — thank you! You may close this tab.")else:ui.markdown("### You're all done! Great job! Please let your experimenter know you're finished.")async def _export_and_push_gitlab(metadata_file=None):787 unmodified lines78878979079179279379480 unmodified lines875876877878879880881787 unmodified linesf"### You collected **{partner_pts} coins** for your partner (**#{partner}**) → "f"we will send them a bonus of **${to_money(partner_pts):.2f}**!")ui.markdown("### Please answer a couple more questions about the game you just played.")ev = asyncio.Event()ui.button("Continue", on_click=ev.set).props("color=primary size=lg")await ev.wait()80 unmodified lineselse:ui.markdown("### You're all done — thank you! You may close this tab.")else:ui.markdown("### Completed! Please let your experimenter know you're ready.")async def _export_and_push_gitlab(metadata_file=None):