Skip to content

Commit

Permalink
Merge pull request #3761 from unicef/develop
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
robertavram authored Sep 11, 2024
2 parents 7e94308 + eb14da9 commit bc25b51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/etools/applications/field_monitoring/planning/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,10 @@ def check_if_rejected(self, old_instance):
)

def send_submit_notice(self):
recipients = set(self.country_pmes)

if self.report_reviewer:
recipients = [self.report_reviewer]
else:
# edge case: if visit was already sent to tpm before report reviewer has become mandatory, apply old logic
recipients = self.country_pmes
recipients.add(self.report_reviewer)

if self.monitor_type == self.MONITOR_TYPE_CHOICES.staff:
email_template = 'fm/activity/staff-submit'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ def goto(next_status, user, extra_data=None, mail_count=None):
goto('data_collection', visit_lead)
goto('report_finalization', visit_lead)
goto('submitted', visit_lead, {'report_reviewer': UserFactory(report_reviewer=True).id},
mail_count=1)
mail_count=activity.country_pmes.count() + 1) # +1: send to report reviewer if set
goto('report_finalization', self.pme, mail_count=1)
goto('submitted', visit_lead, mail_count=activity.country_pmes.count())
goto('submitted', visit_lead, mail_count=activity.country_pmes.count() + 1) # +1: send to report reviewer if set
goto('completed', self.pme)
activity.status = "submitted"
activity.save(update_fields=["status"])
Expand Down

0 comments on commit bc25b51

Please sign in to comment.