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

Foorm: Minor rollups fixes #34890

Merged
merged 5 commits into from
May 20, 2020
Merged

Foorm: Minor rollups fixes #34890

merged 5 commits into from
May 20, 2020

Conversation

molly-moen
Copy link
Contributor

@molly-moen molly-moen commented May 20, 2020

A couple rollups fixes to make things work for daily workshop pattern:

  • rename tabs to Pre Workshop, Day 1, Day 2,..., Post Workshop (was Day 0, Day 1,..., General)
  • sort tabs to always be in the order Pre Workshop, Day 1,..., Post Workshop (they could come out of order if for some reason someone took the Day 1 survey before the Pre Survey, for example)
  • don't throw an exception if the survey configuration does not have a key and value for an answer choice (ex instead of a hash for an answer choice it uses just 1 string). In that case use the string for the key and value. We want to try to enforce using a key/value but don't want to fail if it's used.
  • add facilitator rollups configuration for CSD and CSP.
  • add a flag bypass_date so we can force-show daily surveys for testing

Testing story

Updated unit tests and ensured existing functionality (CSF Intro) was not affected. This change enables viewing of CSD/CSP rollups, as they were throwing an error due to the new configuration sometimes using strings instead of hashes for answer options.

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@molly-moen molly-moen requested review from breville and a team May 20, 2020 00:14

# Sort summaries so that survey data is ordered in the order surveys
# should be taken in. i.e. Pre-Workshop, Day 1, Day 2,.. Post-Workshop
def self.sort_summary(workshop_summary)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how efficient this is...reading says sort_by is not great, but there are probably a maximum of 12 values to sort here in the worst case so it's probably a non-issue. Any suggestions for improvement are appreciated.

]
},
"CS Discoveries": {
"general": [
{"question_id": "teacher_engagement", "header_text": "Teacher Engagement"},
{"question_id": "overall_success", "header_text": "Overall Success"}
],
"facilitator": [
{"question_id": "facilitator_effectiveness", "header_text": "Facilitator Effectiveness"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love that this is driven by a simple configuration!

if choice_hash.class == Hash && choice_hash.key?(:value) && choice_hash.key?(:text)
choices_obj[choice_hash[:value]] = fill_question_placeholders(choice_hash[:text])
elsif choice_hash.class == String
choices_obj[choice_hash] = fill_question_placeholders(choice_hash)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we emit a warning anywhere when we notice this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question--should I add a honeybadger warning? Something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem that we use honeybadger for these kinds of alerts sometimes, with the idea that we will remedy the issue to try and drive instances to 0 each time it happens. The only downside is reporting the issue every time we render a form, when we really just need to capture it once. For that reason, it could make more sense to detect during seeding (and later, in the authoring UI itself too). But with our current usage levels it doesn't seem unreasonable to just catch in honeybadger.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added honeybadger alert. Let me know if the wording makes sense.

# Sort summaries so that survey data is ordered in the order surveys
# should be taken in. i.e. Pre-Workshop, Day 1, Day 2,.. Post-Workshop
def self.sort_summary(workshop_summary)
temp_summary = workshop_summary.sort_by {|survey_key, _| get_index_for_survey_key(survey_key)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the _ parameter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't then the single variable will be a 2 element array containing the survey_key and summary, so adding _ extracts out the survey_key

@molly-moen molly-moen merged commit 646b6b6 into staging May 20, 2020
@molly-moen molly-moen deleted the molly/rollups branch May 20, 2020 20:05
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.

None yet

2 participants