-
Notifications
You must be signed in to change notification settings - Fork 80
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
BREAKING CHANGE: change EventTime enum #7899
base: dev
Are you sure you want to change the base?
Conversation
Quality Gate passedIssues Measures |
@@ -1,6 +1,6 @@ | |||
package greencity.enums; | |||
|
|||
public enum EventTime { | |||
FUTURE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we use FUTURE
here
Do you think we should update it as well?
@@ -145,7 +145,7 @@ private Predicate getPredicate(FilterEventDto filterEventDto, Long userId, Root< | |||
private void addEventTimePredicate(EventTime eventTime, Root<Event> eventRoot, List<Predicate> predicates) { | |||
if (eventTime != null) { | |||
ListJoin<Event, EventDateLocation> datesJoin = eventRoot.join(Event_.dates, JoinType.LEFT); | |||
if (eventTime == EventTime.FUTURE) { | |||
if (eventTime == EventTime.UPCOMING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test for this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you want me to test it? with unit or integration test? I don't quite get how to unit test it, there's so many thing I need to mock. integration test will be way easier to write in this case, don't you agree?
@@ -145,7 +145,7 @@ private Predicate getPredicate(FilterEventDto filterEventDto, Long userId, Root< | |||
private void addEventTimePredicate(EventTime eventTime, Root<Event> eventRoot, List<Predicate> predicates) { | |||
if (eventTime != null) { | |||
ListJoin<Event, EventDateLocation> datesJoin = eventRoot.join(Event_.dates, JoinType.LEFT); | |||
if (eventTime == EventTime.FUTURE) { | |||
if (eventTime == EventTime.UPCOMING) { | |||
predicates.add( | |||
criteriaBuilder.greaterThan(datesJoin.get(EventDateLocation_.FINISH_DATE), ZonedDateTime.now())); | |||
} else if (eventTime == EventTime.PAST) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need else if
here?
There are only 2 items in the EventTime
enum
I think it is better to have 2 separate if
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No further comments are necessary following Roma’s remarks
GreenCity PR
Issue Link 📋
#6824
Changed
Summary of Changes
This change should fix the bug from issue #6824, if merged at the same time with front-end fix.