Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔞 Update "short" demo survey so people born in 2006 can take it #1131

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

JGreenlee
Copy link
Collaborator

The short version of the demographics survey asks for year of birth and we restrict the valid range of responses so as to not allow participants younger than 18. Last year when I uploaded this, I wrote in 2005 as the upper limit. But theoretically, people born in early 2006 can now participate in those studies.

I found a more generic solution using the ODK forms constraint syntax and some built-in functions they have:
. > 1900 and . + 18 <= format-date(today(), '%Y')

So now we won't have to update this every year; it actually takes into account the current year when validating the form.

The short version of the demographics survey asks for year of birth and we restrict the valid range of responses so as to not allow participants younger than 18.
Last year when I uploaded this, I wrote in 2005 as the upper limit. But theoretically, people born in 2006 can now participate in those studies.

I found a more generic solution using the ODK forms constraint syntax and some built-in functions they have:
`. > 1900 and . + 18 <= format-date(today(), '%Y')`

So now we won't have to update this every year; it actually takes into account the current year when validating the form.
Copy link

codecov bot commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (034bee2) 78.37% compared to head (9be27b1) 78.37%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1131   +/-   ##
=======================================
  Coverage   78.37%   78.37%           
=======================================
  Files          28       28           
  Lines        1702     1702           
  Branches      366      366           
=======================================
  Hits         1334     1334           
  Misses        368      368           
Flag Coverage Δ
unit 78.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@JGreenlee
Copy link
Collaborator Author

Valid

Not valid

image

image

image

image

@shankari shankari merged commit a89247b into e-mission:master Mar 4, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants