Refactor loading chronologically last passed schedule#7
Refactor loading chronologically last passed schedule#7pszemus wants to merge 1 commit intoWowzaMediaSystems:mainfrom
Conversation
rogerlittin
left a comment
There was a problem hiding this comment.
I'm all for reducing the number of lines in the code but I don't like to modify the list inside the if condition check. How about
schedules.add(schedule);
if (schedule.start.before(now))
schedules.removeIf(s -> s.start.before(schedule.start)))I think it should have the same effect but intention is clear.
|
It won't work for: all 3 playlists are started (including both past playlists). We could split my condition into 2 different |
|
@rogerlittin does the following look better to you? |
|
That's really just replacing one large block of code with another large block. The original PR is probably cleaner. I won't be able to merge it for at least a week so if you come up with a better solution in the meantime please update here. |
|
Another idea: always keep the last past schedule at index 0: |
Tested playlists:
result (logs):
result (logs):
result (logs):
result (logs):