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

updated validation to not use question name #116

Closed

Conversation

IanEisenberg
Copy link
Member

Changing validation to not use names so that expfactory/expfactory-surveys#50 can be addressed. The validation now uses the shared meta-text

@IanEisenberg
Copy link
Member Author

New validation:

validation = "%s if (($.unique($('.page%s.required[type=number],.page%s.required:text').map(function(){return $(this).attr('meta-text')})).map(function() {return $('[meta-text*="' + this + '"].required[type=number], [meta-text*="' + this + '"].required:text').filter(function() { return $(this).val();}).length > 0}).get().indexOf(false) != -1) || ($.unique($('.page%s.required:not([type=number]):not(:text)').map(function(){return $(this).attr('meta-text')})).map(function() {return $('[meta-text*="' + this + '"].required:checked').length > 0}).get().indexOf(false) != -1)) {\nis_required($('.page%s.required:not(checked)'));\nreturn false;\n" % (validation, page_number, page_number, page_number)

…ude name, there was another bug with the validation where page3 remained hardcoded. That has been fixed
@vsoch
Copy link
Member

vsoch commented May 5, 2016

Does not work

image

@IanEisenberg
Copy link
Member Author

Ignore this for a moment, still not working.

@IanEisenberg
Copy link
Member Author

actually it was a problem with questionnaire strings sometimes containing '' marks, so now I've used ` and " because python adds in 's to escape quotations when using triple quote syntax, which wouldn't work for javascript! This should work...I think

@vsoch
Copy link
Member

vsoch commented May 6, 2016

What about the case when the text has single quotes, eg ' ?

@vsoch
Copy link
Member

vsoch commented May 6, 2016

ok, since it is clear we need to be able to test the proper function of every survey, I think we need the robot to step through these and confirm making it to the end of each.

@IanEisenberg
Copy link
Member Author

I tested this function with three types of quotes in the meta-text (question) string: ", ', and `. It works with all of them. Robot testing would be good too

@vsoch
Copy link
Member

vsoch commented May 7, 2016

@IanEisenberg could you please rebase with master? I now have a survey robot to test this new change.

@IanEisenberg
Copy link
Member Author

Done.

On Sat, May 7, 2016 at 11:25 AM, Vanessa Sochat [email protected]
wrote:

@IanEisenberg https://github.com/IanEisenberg could you please rebase
with master? I now have a survey robot to test this new change.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#116 (comment)

Best,
Ian

@vsoch
Copy link
Member

vsoch commented May 7, 2016

Ty!

@vsoch
Copy link
Member

vsoch commented May 7, 2016

Ok, I've tested all surveys with the new validation, and was able to make the name change to ensure that the checkboxes have unique names, eg:

  {"name":"demographics_survey_6_0_options","value":"American Indian or Alaska Native","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
  {"name":"demographics_survey_6_1_options","value":"Asian","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
  {"name":"demographics_survey_6_2_options","value":"Black or African American","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
  {"name":"demographics_survey_6_3_options","value":"Native Hawaiian or Other Pacific Islander","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
  {"name":"demographics_survey_6_4_options","value":"White","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
  {"name":"demographics_survey_6_5_options","value":"Choose not to respond","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"}

After this is merged, I will update expfactory on expfactory.org, and we will want to immediately test taking a survey, and seeing if all checkbox responses are represented in the results. The unique names should ensure that they are.

@IanEisenberg
Copy link
Member Author

I will be ready to test whenever you tell me.

On Sat, May 7, 2016 at 1:35 PM, Vanessa Sochat [email protected]
wrote:

Ok, I've tested all surveys with the new validation, and was able to make
the name change to ensure that the checkboxes have unique names, eg:

{"name":"demographics_survey_6_0_options","value":"American Indian or Alaska Native","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
{"name":"demographics_survey_6_1_options","value":"Asian","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
{"name":"demographics_survey_6_2_options","value":"Black or African American","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
{"name":"demographics_survey_6_3_options","value":"Native Hawaiian or Other Pacific Islander","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
{"name":"demographics_survey_6_4_options","value":"White","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"},
{"name":"demographics_survey_6_5_options","value":"Choose not to respond","options":"American Indian or Alaska Native|Asian|Black or African American|Native Hawaiian or Other Pacific Islander|White|Choose not to respond|Other","text":"What is your race?"}

After this is merged, I will update expfactory on expfactory.org, and we
will want to immediately test taking a survey, and seeing if all checkbox
responses are represented in the results. The unique names should ensure
that they are.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#116 (comment)

Best,
Ian

@vsoch vsoch mentioned this pull request May 7, 2016
@vsoch vsoch closed this in #119 May 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants