Skip to content

Commit

Permalink
refactor(core): Change shift request day to date
Browse files Browse the repository at this point in the history
  • Loading branch information
j3soon committed Aug 10, 2024
1 parent d87de38 commit 748f379
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion core/nurse_scheduling/preference_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def shift_request(ctx: Context, preference, preference_idx):
# Note that a shift is represented as (d, r)
# i.e., max(weight * shifts[(d, r, p)]), for all satisfying (d, r)
p = preference.person
preference_days = utils.parse_dates(preference.day, ctx.startdate, ctx.enddate)
preference_days = utils.parse_dates(preference.date, ctx.startdate, ctx.enddate)
for date in preference_days:
d = (date - ctx.startdate).days
r = ctx.map_rid_r[preference.shift]
Expand Down
26 changes: 13 additions & 13 deletions core/tests/testcases/or-tools-example_2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,57 +25,57 @@ preferences:
# Person 0
- type: shift request
person: 0
day: [1, 5, 7]
date: [1, 5, 7]
shift: N
- type: shift request
person: 0
day: 6
date: 6
shift: E
# Person 1
- type: shift request
person: 1
day: 5
date: 5
shift: D
- type: shift request
person: 1
day: [3, 4]
date: [3, 4]
shift: E
- type: shift request
person: 1
day: 7
date: 7
shift: N
# Person 2
- type: shift request
person: 2
day: 4
date: 4
shift: D
- type: shift request
person: 2
day: [1, 2, 6]
date: [1, 2, 6]
shift: E
# Person 3
- type: shift request
person: 3
day: [3, 6]
date: [3, 6]
shift: D
- type: shift request
person: 3
day: 4
date: 4
shift: E
- type: shift request
person: 3
day: 1
date: 1
shift: N
# Person 4
- type: shift request
person: 4
day: 5
date: 5
shift: D
- type: shift request
person: 4
day: [3, 6]
date: [3, 6]
shift: E
- type: shift request
person: 4
day: 2
date: 2
shift: N
26 changes: 13 additions & 13 deletions core/tests/testcases/or-tools-example_2_begin-date.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,57 +25,57 @@ preferences:
# Person 0
- type: shift request
person: 0
day: [2, 6, 8]
date: [2, 6, 8]
shift: N
- type: shift request
person: 0
day: 7
date: 7
shift: E
# Person 1
- type: shift request
person: 1
day: 6
date: 6
shift: D
- type: shift request
person: 1
day: [4, 5]
date: [4, 5]
shift: E
- type: shift request
person: 1
day: 8
date: 8
shift: N
# Person 2
- type: shift request
person: 2
day: 5
date: 5
shift: D
- type: shift request
person: 2
day: [2, 3, 7]
date: [2, 3, 7]
shift: E
# Person 3
- type: shift request
person: 3
day: [4, 7]
date: [4, 7]
shift: D
- type: shift request
person: 3
day: 5
date: 5
shift: E
- type: shift request
person: 3
day: 2
date: 2
shift: N
# Person 4
- type: shift request
person: 4
day: 6
date: 6
shift: D
- type: shift request
person: 4
day: [4, 7]
date: [4, 7]
shift: E
- type: shift request
person: 4
day: 3
date: 3
shift: N
26 changes: 13 additions & 13 deletions core/tests/testcases/or-tools-example_2_date-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,57 +25,57 @@ preferences:
# Person 0
- type: shift request
person: 0
day: [2023-09-02, 2023-09-06, 2023-09-08]
date: [2023-09-02, 2023-09-06, 2023-09-08]
shift: N
- type: shift request
person: 0
day: 2023-09-07
date: 2023-09-07
shift: E
# Person 1
- type: shift request
person: 1
day: 2023-09-06
date: 2023-09-06
shift: D
- type: shift request
person: 1
day: [2023-09-04, 2023-09-05]
date: [2023-09-04, 2023-09-05]
shift: E
- type: shift request
person: 1
day: 2023-09-08
date: 2023-09-08
shift: N
# Person 2
- type: shift request
person: 2
day: 09-05
date: 09-05
shift: D
- type: shift request
person: 2
day: [09-02, 09-03, 09-07]
date: [09-02, 09-03, 09-07]
shift: E
# Person 3
- type: shift request
person: 3
day: [09-04, 09-07]
date: [09-04, 09-07]
shift: D
- type: shift request
person: 3
day: 09-05
date: 09-05
shift: E
- type: shift request
person: 3
day: 09-02
date: 09-02
shift: N
# Person 4
- type: shift request
person: 4
day: 6
date: 6
shift: D
- type: shift request
person: 4
day: [4, 7]
date: [4, 7]
shift: E
- type: shift request
person: 4
day: 3
date: 3
shift: N

0 comments on commit 748f379

Please sign in to comment.