citizenlab icon indicating copy to clipboard operation
citizenlab copied to clipboard

TAN-1164 - Merge survey result generator with survey response grouper

Open jamesspeake opened this issue 11 months ago • 4 comments

Changes made to SurveyResultsGeneratorService

SurveyResultsGeneratorService is now called with additional parameters in SurveyQuestionResult instead of SurveyResponseGrouper:

service.generate_results(
  field_id: question_id,
  group_mode: group_mode,
  group_field_id: group_field_id
)

To bring the two services together, the following structural changes have been made to the structure of the SurveyResponseGrouper service:

  • totalResponses -> totalResponseCount - To be more consistent in naming counts
  • questionResponseCount - Has been added - This is the number of responses that have answered this question
  • totalPicks -> totalPickCount - for consistency in naming
  • multilocs->answer->key now has title_multiloc inserted to allow for image to also be added into this data for image question types ie multilocs now looks like this:
multilocs: {
  answer: {
    cat: { title_multiloc: { en: 'Cat' } },
    dog: { title_multiloc: { en: 'Dog' } }
  }
}

Changelog

Changed

  • Added question numbers to survey results

Technical

  • Merged two APIs and changed structure for consistency between all survey results

jamesspeake avatar Mar 07 '24 17:03 jamesspeake

Warnings
:warning: The PR title contains no Jira issue key (case-sensitive)
:warning: The branch name contains no Jira issue key (case-sensitive)
Messages
:book: Changelog provided 🎉
:book:

Run the e2e tests

:book: Check translation progress

Generated by :no_entry_sign: dangerJS against 7c36d0ed65fd75c122a0d66789f90ee53ab503da

cl-dev-bot avatar Mar 07 '24 18:03 cl-dev-bot

@luucvanderzee @alexander-cit Sorry meant to share this on Friday for review. Think I've done everything to get the new format working with the existing components. However on the front-end, there is probably some further work that needs to be done to bring to two sets of components/types together. I haven't done this.

I also have another backend branch open off this with a couple of perf improvements I've been playing around with that hopefully I'll have a chance to complete this week, but they're not essential.

jamesspeake avatar Mar 11 '24 08:03 jamesspeake

I made a PR with some suggestions / extra tests: https://github.com/CitizenLabDotCo/citizenlab/pull/7302/files Will now do a separate review for the FE part

luucvanderzee avatar Mar 11 '24 14:03 luucvanderzee