making the weekend check more readable

This commit is contained in:
Tibor Kaputa 2021-03-10 15:51:29 +01:00 committed by GitHub
parent 5819760b55
commit 525716d832
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,5 +164,9 @@ const val REMINDER_EMAIL = 1
fun getNowSeconds() = System.currentTimeMillis() / 1000L fun getNowSeconds() = System.currentTimeMillis() / 1000L
fun isWeekend(i: Int, isSundayFirst: Boolean): Boolean { fun isWeekend(i: Int, isSundayFirst: Boolean): Boolean {
return (i + if (isSundayFirst) 6 else 0) % 7 > 4 return if (isSundayFirst) {
i == 0 || i == 6 || i == 7 || i == 13
} else {
i == 5 || i == 6 || i == 12 || i == 13
}
} }