Skip to content

remove temp fix #620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/services/ChallengeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -1617,17 +1617,16 @@ async function updateChallenge(currentUser, challengeId, data) {
const finalStatus = data.status || challenge.status;
const finalTimelineTemplateId = data.timelineTemplateId || challenge.timelineTemplateId;
let timelineTemplateChanged = false;
// if (!_.get(data, "legacy.pureV5") && !_.get(challenge, "legacy.pureV5")) {
// if (
// finalStatus !== constants.challengeStatuses.New &&
// finalTimelineTemplateId !== challenge.timelineTemplateId
// ) {
// throw new errors.BadRequestError(
// `Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`
// );
// }
// } else
if (finalTimelineTemplateId !== challenge.timelineTemplateId) {
if (!_.get(data, "legacy.pureV5") && !_.get(challenge, "legacy.pureV5")) {
if (
finalStatus !== constants.challengeStatuses.New &&
finalTimelineTemplateId !== challenge.timelineTemplateId
) {
throw new errors.BadRequestError(
`Cannot change the timelineTemplateId for challenges with status: ${finalStatus}`
);
}
} else if (finalTimelineTemplateId !== challenge.timelineTemplateId) {
// make sure there are no previous phases if the timeline template has changed
challenge.phases = [];
timelineTemplateChanged = true;
Expand Down