Skip to content

Multi survey#545

Open
ajparsons wants to merge 4 commits intono-translate-errorfrom
multi-survey
Open

Multi survey#545
ajparsons wants to merge 4 commits intono-translate-errorfrom
multi-survey

Conversation

@ajparsons
Copy link
Copy Markdown
Contributor

@ajparsons ajparsons commented Mar 27, 2026

Implements #536

The problem is we don't survey messages sent to multiple people (because originally the key question was about if one person wrote back). Now most questions are about the sender - and in Wales it's only going to be a multi-member constituency, so we want to make sure we are capturing this if people are using the option (especially if they're more likely to use if if they don't know who to write to).

Basically the key thing is a change in the queue that sets no_questionnaire to true for all but the first message in a group block.

Then there's a number of changes to the content:

  • Content of questionnaire email slightly changes to ask 'if any reps replied' rather than just one.
  • q0 gets a '_m' suffix if it's a multi email (avoids potential misinterpretation as this is now a group value being recorded against a single rep - we don't do individual analysis at the moment but this helps catch that if we did).
  • some minor tweaks to the web survey to reflect result of email survey.

I've tested this as far as I can on the survey side - but will need some help to test the queue bit.

@ajparsons ajparsons requested a review from struan March 27, 2026 12:31
Copy link
Copy Markdown
Member

@struan struan left a comment

Choose a reason for hiding this comment

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

I'm afraid the template changes here aren't going to work because they're not parsed as php.

Would also be nice to add something to bin/test-run to check that something is sent, and that only one is sent. I suspect you can crib the code from do_send_example_message and update do_send_group_message accordingly

@@ -1,11 +1,27 @@
<?=$values['weeks_ago']?> weeks ago we sent your letter to <?=$values['recipient_name']?>, your
<?=$values['recipient_position']?>. (For reference, there's a copy of your
<?=$values['weeks_ago']?> weeks ago we sent your letter to <?php if ($values['is_multi']) { ?>your <?=$values['recipient_position_plural']?><?php } else { ?><?=$values['recipient_name']?>, your
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are parsed by mySociety::Email.pm so only do simple substitution so php tags will be included verbatim. If you want to do this you'll either need a separate template for multi person messages or do the logic in the code.

// Check if this is a multi-recipient message
$is_multi = false;
if (!$preview) {
$is_multi = msg_is_multi_questionnaire_message($token) ? true : false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could you not do msg_is_multi_questionnaire_message($token) == 1 here to be explicit and also skip the ternary?

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