-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into task/upgrade-play-2.9
- Loading branch information
Showing
9 changed files
with
189 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package services | ||
|
||
import anorm._ | ||
import anorm.SqlParser.scalar | ||
import helper.BusinessDaysCalculator | ||
import java.time.{LocalDate, ZonedDateTime} | ||
import javax.inject.{Inject, Singleton} | ||
import play.api.db.Database | ||
|
||
@Singleton | ||
class BusinessDaysService @Inject() (db: Database) { | ||
|
||
val publicHolidays: List[LocalDate] = db.withTransaction { implicit connection => | ||
SQL("SELECT holiday_date FROM public_holidays").as(scalar[LocalDate].*) | ||
} | ||
|
||
private val publicHolidaySet: Set[LocalDate] = publicHolidays.toSet | ||
|
||
def businessHoursBetween(startTime: ZonedDateTime, endTime: ZonedDateTime): Int = | ||
BusinessDaysCalculator.businessHoursBetween(startTime, endTime, publicHolidaySet) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
-- !Ups | ||
|
||
CREATE TABLE public_holidays ( | ||
holiday_date date PRIMARY KEY | ||
); | ||
|
||
-- https://www.data.gouv.fr/fr/datasets/jours-feries-en-france/ | ||
INSERT INTO public_holidays (holiday_date) VALUES | ||
('2017-01-01'), | ||
('2017-04-17'), | ||
('2017-05-01'), | ||
('2017-05-08'), | ||
('2017-05-25'), | ||
('2017-06-05'), | ||
('2017-07-14'), | ||
('2017-08-15'), | ||
('2017-11-01'), | ||
('2017-11-11'), | ||
('2017-12-25'), | ||
('2018-01-01'), | ||
('2018-04-02'), | ||
('2018-05-01'), | ||
('2018-05-08'), | ||
('2018-05-10'), | ||
('2018-05-21'), | ||
('2018-07-14'), | ||
('2018-08-15'), | ||
('2018-11-01'), | ||
('2018-11-11'), | ||
('2018-12-25'), | ||
('2019-01-01'), | ||
('2019-04-22'), | ||
('2019-05-01'), | ||
('2019-05-08'), | ||
('2019-05-30'), | ||
('2019-06-10'), | ||
('2019-07-14'), | ||
('2019-08-15'), | ||
('2019-11-01'), | ||
('2019-11-11'), | ||
('2019-12-25'), | ||
('2020-01-01'), | ||
('2020-04-13'), | ||
('2020-05-01'), | ||
('2020-05-08'), | ||
('2020-05-21'), | ||
('2020-06-01'), | ||
('2020-07-14'), | ||
('2020-08-15'), | ||
('2020-11-01'), | ||
('2020-11-11'), | ||
('2020-12-25'), | ||
('2021-01-01'), | ||
('2021-04-05'), | ||
('2021-05-01'), | ||
('2021-05-08'), | ||
('2021-05-13'), | ||
('2021-05-24'), | ||
('2021-07-14'), | ||
('2021-08-15'), | ||
('2021-11-01'), | ||
('2021-11-11'), | ||
('2021-12-25'), | ||
('2022-01-01'), | ||
('2022-04-18'), | ||
('2022-05-01'), | ||
('2022-05-08'), | ||
('2022-05-26'), | ||
('2022-06-06'), | ||
('2022-07-14'), | ||
('2022-08-15'), | ||
('2022-11-01'), | ||
('2022-11-11'), | ||
('2022-12-25'), | ||
('2023-01-01'), | ||
('2023-04-10'), | ||
('2023-05-01'), | ||
('2023-05-08'), | ||
('2023-05-18'), | ||
('2023-05-29'), | ||
('2023-07-14'), | ||
('2023-08-15'), | ||
('2023-11-01'), | ||
('2023-11-11'), | ||
('2023-12-25'), | ||
('2024-01-01'), | ||
('2024-04-01'), | ||
('2024-05-01'), | ||
('2024-05-08'), | ||
('2024-05-09'), | ||
('2024-05-20'), | ||
('2024-07-14'), | ||
('2024-08-15'), | ||
('2024-11-01'), | ||
('2024-11-11'), | ||
('2024-12-25'), | ||
('2025-01-01'), | ||
('2025-04-21'), | ||
('2025-05-01'), | ||
('2025-05-08'), | ||
('2025-05-29'), | ||
('2025-06-09'), | ||
('2025-07-14'), | ||
('2025-08-15'), | ||
('2025-11-01'), | ||
('2025-11-11'), | ||
('2025-12-25'), | ||
('2026-01-01'), | ||
('2026-04-06'), | ||
('2026-05-01'), | ||
('2026-05-08'), | ||
('2026-05-14'), | ||
('2026-05-25'), | ||
('2026-07-14'), | ||
('2026-08-15'), | ||
('2026-11-01'), | ||
('2026-11-11'), | ||
('2026-12-25'), | ||
('2027-01-01'), | ||
('2027-03-29'), | ||
('2027-05-01'), | ||
('2027-05-06'), | ||
('2027-05-08'), | ||
('2027-05-17'), | ||
('2027-07-14'), | ||
('2027-08-15'), | ||
('2027-11-01'), | ||
('2027-11-11'), | ||
('2027-12-25'), | ||
('2028-01-01'), | ||
('2028-04-17'), | ||
('2028-05-01'), | ||
('2028-05-08'), | ||
('2028-05-25'), | ||
('2028-06-05'), | ||
('2028-07-14'), | ||
('2028-08-15'), | ||
('2028-11-01'), | ||
('2028-11-11'), | ||
('2028-12-25') | ||
; | ||
|
||
|
||
-- !Downs | ||
|
||
DROP TABLE public_holidays; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.9.6 | ||
sbt.version=1.9.7 |