diff --git a/opentech/apply/activity/messaging.py b/opentech/apply/activity/messaging.py index 415b9e029570c14c53072f8104181599d7f9667d..8908bf7aa351cf27f9c8dd4bb116627c50593462 100644 --- a/opentech/apply/activity/messaging.py +++ b/opentech/apply/activity/messaging.py @@ -65,7 +65,7 @@ class ActivityAdapter(AdapterBase): MESSAGES.NEW_SUBMISSION: 'Submitted {submission.title} for {submission.page.title}', MESSAGES.UPDATE_LEAD: 'Lead changed from {old.lead} to {submission.lead}', MESSAGES.NEW_DETERMINATION: 'Created a determination for {submission.title}', - MESSAGES.DETERMINATION_OUTCOME: 'Sent a {submission.determination.get_outcome_display} determination for {submission.title}:\r\n{determination.clean_message}', + MESSAGES.DETERMINATION_OUTCOME: 'Sent a {submission.determination.get_outcome_display} determination for {submission.title}:\r\n{submission.determination.clean_message}', MESSAGES.INVITED_TO_PROPOSAL: '{submission.title} has been invited to submit a proposal.', MESSAGES.REVIEWERS_UPDATED: 'reviewers_updated', MESSAGES.NEW_REVIEW: 'Created a review for {submission.title}' @@ -102,6 +102,8 @@ class SlackAdapter(AdapterBase): MESSAGES.TRANSITION: '{user} has updated the status of <{link}|{submission.title}>: {old_phase.display_name} → {submission.phase}', MESSAGES.DETERMINATION_OUTCOME: 'A determination for <{link}|{submission.title}> was sent by email: {submission.determination.get_outcome_display}', MESSAGES.PROPOSAL_SUBMITTED: 'A proposal has been submitted for review: <{link}|{submission.title}>', + MESSAGES.INVITED_TO_PROPOSAL: '<{link}|{submission.title}> by {submission.user} has been invited to submit a proposal', + MESSAGES.NEW_REVIEW: '{user} has submitted a review for <{link}|{submission.title}>. Outcome: {review.outcome} Score: {review.score}' } def __init__(self): diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py index 30fb9d80fd5730485399f4515dd6f2a9c551b60d..7beb2aeb6524ee27ecb9185941ce09f820b01ed7 100644 --- a/opentech/apply/funds/views.py +++ b/opentech/apply/funds/views.py @@ -84,7 +84,7 @@ class ProgressSubmissionView(DelegatedViewMixin, UpdateView): self.object.perform_transition(action, self.request.user, request=self.request) - if object.phase.name == 'proposal_discussion' and action == 'proposal_discussion': + if self.object.phase.name == 'proposal_discussion' and action == 'proposal_discussion': messenger( MESSAGES.PROPOSAL_SUBMITTED, request=self.request, diff --git a/opentech/apply/review/forms.py b/opentech/apply/review/forms.py index d15bb4ab211f0baf9bca2529d53d5f9d14de406f..d16b99a989fe44c4049fb5e55c720b4dea085f48 100644 --- a/opentech/apply/review/forms.py +++ b/opentech/apply/review/forms.py @@ -76,7 +76,7 @@ class ReviewModelForm(StreamBaseForm, forms.ModelForm, metaclass=MixedMetaClass) def save(self, commit=True): self.instance.score = self.calculate_score(self.cleaned_data) - self.instance.recommendation = self.cleaned_data[get_recommendation_field(self.instance.form_fields)] + self.instance.recommendation = int(self.cleaned_data[get_recommendation_field(self.instance.form_fields)]) self.instance.is_draft = self.draft_button_name in self.data self.instance.form_data = self.cleaned_data['form_data'] diff --git a/opentech/apply/review/models.py b/opentech/apply/review/models.py index 8b46555950d041799b4d515e9e0d5fbf0ddca66d..5d093e7b87e00f8a4c5c69a8db60fd0f68388e56 100644 --- a/opentech/apply/review/models.py +++ b/opentech/apply/review/models.py @@ -87,6 +87,10 @@ class Review(BaseStreamForm, models.Model): class Meta: unique_together = ('author', 'submission') + @property + def outcome(self): + return self.get_recommendation_display() + def get_absolute_url(self): return reverse('apply:reviews:review', args=(self.id,)) diff --git a/opentech/apply/review/views.py b/opentech/apply/review/views.py index 1fbe123477922e0dc56dcc144a12bbfa73c94722..588c896b34c65cdf2b4c4a0785a48ee1c85d29d3 100644 --- a/opentech/apply/review/views.py +++ b/opentech/apply/review/views.py @@ -90,6 +90,7 @@ class ReviewCreateOrUpdateView(BaseStreamForm, CreateOrUpdateView): request=self.request, user=self.object.author, submission=self.submission, + review=self.object, ) return response