Skip to content
Snippets Groups Projects
Commit 1426cfce authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Don't run ScoreCalculatorFactoryImpl's event handlers if roomId is null

parent 7bc75f68
No related merge requests found
Pipeline #22173 passed with warnings with stages
in 1 minute and 45 seconds
......@@ -56,31 +56,31 @@ public class ScoreCalculatorFactoryImpl implements ScoreCalculatorFactory, Appli
return scoreCalculator;
}
@CacheEvict(value = "score", key = "#event.entity.roomId")
@CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener
public void handleAfterContentCreation(AfterCreationEvent<Content> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
}
@CacheEvict(value = "score", key = "#event.entity.roomId")
@CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener(condition = "#event.stateName == 'state'")
public void handleContentStateChange(StateChangeEvent<Content, Content.State> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
}
@CacheEvict(value = "score", key = "#event.entity.roomId")
@CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener
public void handleNewAnswer(AfterCreationEvent<Answer> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
}
@CacheEvict(value = "score", key = "#event.entity.roomId")
@CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener
public void handleDeleteAnswer(AfterDeletionEvent<Answer> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
}
@CacheEvict(value = "score", key = "#event.entity.roomId")
@CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener
public void handleDeleteQuestion(AfterDeletionEvent<Content> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment