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

[FIXED] Working time issue when it is started on weekend #375

Merged
merged 7 commits into from
Dec 23, 2024

Conversation

hossain-khan
Copy link
Owner

@hossain-khan hossain-khan commented Dec 23, 2024

Now, it has when with more cases to consider the startDateTime

Fixes #372


This pull request includes various updates and improvements to the Kotlin codebase. The changes focus on improving logging levels, correcting documentation, and enhancing the handling of working hours and dates.

Logging Improvements:

  • Changed the logging level from Log.i to Log.w in src/main/kotlin/CodeSnippets.kt and src/main/kotlin/Main.kt to appropriately reflect the warning nature of the messages. [1] [2]

Documentation Corrections:

  • Fixed a typo in the documentation comment in src/main/kotlin/dev/hossain/githubstats/repository/PullRequestStatsRepoImpl.kt from "use to review" to "user to review".

Working Hours and Dates Handling:

  • Enhanced the logic for determining the next working hour in src/main/kotlin/dev/hossain/time/DateTimeDiffer.kt by adding conditions to handle non-working days and hours more accurately.
  • Added a check to ensure both start and end date-times are on working days, throwing an IllegalArgumentException if not, in src/main/kotlin/dev/hossain/time/DateTimeDiffer.kt.
  • Expanded the documentation and examples for the NEXT_NON_WORKING_HOUR_OR_SAME adjuster in src/main/kotlin/dev/hossain/time/TemporalsExtension.kt.
  • Added a new function nextNonWorkingHour in src/main/kotlin/dev/hossain/time/ZonedDateTimeExtension.kt to provide the next non-working hour for a given date-time, with detailed examples.

This pull request includes several changes to improve logging, documentation, and functionality related to working hours calculations in Kotlin files. The most important changes are grouped by theme below:

Logging Improvements:

  • Changed the logging level from Log.i to Log.w for displaying disclaimers about review time in src/main/kotlin/CodeSnippets.kt and src/main/kotlin/Main.kt. [1] [2]

Documentation Enhancements:

  • Improved the documentation for the PullRequestStatsRepoImpl class by correcting a typo and adding more details to the workingDuration function in DateTimeDiffer.kt. [1] [2]
  • Added examples and detailed comments to the TemporalsExtension and ZonedDateTimeExtension files to clarify the behavior of working hour calculations. [1] [2]

Functionality Improvements:

  • Enhanced the DateTimeDiffer object to handle weekends and non-working hours more accurately, including adding debug statements and handling edge cases.
  • Added new test cases in PullRequestStatsRepoTest and DateTimeDifferTest to verify the correct calculation of review times and working hours, particularly for scenarios involving weekends. [1] [2] [3]

Now, it has when with more cases to consider the `startDateTime`

Fixes #372
@hossain-khan hossain-khan self-assigned this Dec 23, 2024
@hossain-khan hossain-khan merged commit 04f471a into main Dec 23, 2024
1 check passed
@hossain-khan hossain-khan deleted the 372-fix-working-hour branch December 23, 2024 05:28
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.

Keep getting "This function can only handle working day diff" error
1 participant