Skip to content
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

Solution refactoring (according to comment to pull request) #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mateuszszulc
Copy link

@mateuszszulc mateuszszulc commented Mar 31, 2017

  1. Removed unnecessary if-checks
  2. Simplified restEpoch computation
  3. Replaced forEach with flatMap
  4. DailyUsage made less anemic, has now isMultiDaySession method

In the next step i would move the whole generateSessionDays() logic to DailyUsage.

Dislaimer: There may be issues, I haven't checked the code to long. I was focused only on the logic, I haven't refactored names, etc.

Known issues:

  1. getMidnightOfDate duplication
  2. (int) wholeDaysCount -> overflow risk

If you found more issues, please give a feedback.

1. Removed unnecessary if-checks
2. Simplified restEpoch computation
3. Replaced forEach with flatMap
4. DailyUsage made less anemic, has now isMultiDaySession method

In the next step i would move the whole generateSessionDays() logic to DailyUsage. 

Dislaimer: There may be issues, I haven't checked the code to long.

Known issues:
1. getMidnightOfDate duplication 
2. (int) wholeDaysCount -> overflow risk

If you found more issues, please give a feedback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant