Skip to content

Commit

Permalink
Enabled editing of surveys for published engagements (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
saravanpa-aot authored Nov 8, 2023
1 parent c51882d commit f60be68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion met-api/src/met_api/services/survey_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def update(cls, data: SurveySchema):
is_template = survey.get('is_template', None)
cls.validate_template_surveys_edit_access(is_template, user_roles)

if engagement and engagement.get('status_id', None) != Status.Draft.value:
if engagement and engagement.get('status_id', None) not in [Status.Draft.value, Status.Published.value]:
raise ValueError('Engagement already published')

updated_survey = SurveyModel.update_survey(data)
Expand Down
8 changes: 2 additions & 6 deletions met-web/src/components/survey/building/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const SurveyFormBuilder = () => {
dispatch(
openNotification({
severity: 'warning',
text: 'Engagement already published. Saving is disabled.',
text: 'Engagement already published. Please be careful while editing the survey.',
}),
);
}
Expand Down Expand Up @@ -410,11 +410,7 @@ const SurveyFormBuilder = () => {
</Grid>
<Grid item xs={12}>
<Stack direction="row" spacing={2}>
<PrimaryButton
disabled={!formData || hasPublishedEngagement}
loading={isSaving}
onClick={handleSaveForm}
>
<PrimaryButton disabled={!formData} loading={isSaving} onClick={handleSaveForm}>
{'Save & Continue'}
</PrimaryButton>
<SecondaryButton onClick={() => navigate('/surveys')}>Cancel</SecondaryButton>
Expand Down

0 comments on commit f60be68

Please sign in to comment.