Last active
May 2, 2019 04:08
-
-
Save vladbatushkov/ad61882b62dd8a2a5ae9ff4d09199f2d to your computer and use it in GitHub Desktop.
Generate a graph with nodes of working days and weekends.
This file contains hidden or 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
WITH date({ year: 2019, month: 12, day: 31 }) as lastDay | |
UNWIND range(1, lastDay.ordinalDay) as iterator | |
WITH date(toString(lastDay.year) + CASE WHEN iterator <= 9 THEN "00" WHEN iterator > 9 AND iterator <= 99 THEN "0" ELSE "" END + toString(iterator)) as day | |
FOREACH(day IN CASE WHEN (day.dayOfWeek > 5) THEN [day] ELSE [] END | | |
CREATE (:Weekend { day: day, workingHours: 0 }) | |
) | |
FOREACH(day IN CASE WHEN (day.dayOfWeek < 6) THEN [day] ELSE [] END | | |
CREATE (:WorkingDay { day: day, workingHours: 8 }) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment