Skip to content

Commit

Permalink
avoid notifications for quiz updates before release date, fix issue i…
Browse files Browse the repository at this point in the history
…n quiz generation when title is undefined

Signed-off-by: Stephan Krusche <[email protected]>
  • Loading branch information
Stephan Krusche committed Apr 23, 2019
1 parent e7397b9 commit 264511e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ public void notifyStudentGroupAboutExercisePractice(Exercise exercise) {
}

public void notifyStudentGroupAboutExerciseUpdate(Exercise exercise) {
if (exercise.getReleaseDate() != null && !exercise.getReleaseDate().isBefore(ZonedDateTime.now())) {
if (exercise.getReleaseDate() != null && exercise.getReleaseDate().isAfter(ZonedDateTime.now())) {
return;
}
String title = "Exercise updated";
String notificationText = "Exercise \"" + exercise.getTitle() + "\" got updated.";
String notificationText = "Exercise \"" + exercise.getTitle() + "\" was updated.";
notifyStudentGroupAboutExerciseChange(exercise, title, notificationText);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ public ResponseEntity<QuizExercise> updateQuizExercise(@RequestBody QuizExercise
// notify websocket channel of changes to the quiz exercise
quizExerciseService.sendQuizExerciseToSubscribedClients(result);

groupNotificationService.notifyStudentGroupAboutExerciseUpdate(result);
// NOTE: it does not make sense to notify students here!
// groupNotificationService.notifyStudentGroupAboutExerciseUpdate(result);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, quizExercise.getId().toString())).body(result);
}

Expand Down Expand Up @@ -390,7 +391,6 @@ public ResponseEntity<QuizExercise> reEvaluateQuizExercise(@RequestBody QuizExer
quizStatisticService.recalculateStatistics(updatedQuizExercise);
}

groupNotificationService.notifyStudentGroupAboutExerciseUpdate(updatedQuizExercise);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, quizExercise.getId().toString())).body(updatedQuizExercise);
}
}
10 changes: 5 additions & 5 deletions src/main/webapp/app/components/util/markdown.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export class ArtemisMarkdown {
* @return {string}
*/
generateTextHintExplanation(sourceObject: MarkDownElement) {
return (
sourceObject.text +
(sourceObject.hint ? '\n\t' + HintCommand.identifier + ' ' + sourceObject.hint : '') +
(sourceObject.explanation ? '\n\t' + ExplanationCommand.identifier + ' ' + sourceObject.explanation : '')
);
return sourceObject.text
? sourceObject.text
: '' +
(sourceObject.hint ? '\n\t' + HintCommand.identifier + ' ' + sourceObject.hint : '') +
(sourceObject.explanation ? '\n\t' + ExplanationCommand.identifier + ' ' + sourceObject.explanation : '');
}

/**
Expand Down

0 comments on commit 264511e

Please sign in to comment.