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

feat: add monthly rotation option #3243

Merged
merged 40 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d1af692
add monthly rotation feat
Aug 21, 2023
62d9d99
Merge branch 'master' into feat/monthly-rotation
allending313 Aug 22, 2023
51cb81a
update db-schema
Aug 22, 2023
af86af3
revert migration update, create new migration
Aug 22, 2023
9e3d9ff
update models.go
Aug 22, 2023
3091f82
update monthly start/end to be datetime-from-start-of-month
mastercactapus Aug 22, 2023
814c023
update monthly rotation logic
Aug 24, 2023
34bce95
make db-schema && make generate
Forfold Aug 28, 2023
94748b3
Merge branch 'master' into feat/monthly-rotation
Forfold Aug 28, 2023
d4bb395
fix ts error
Forfold Aug 29, 2023
8eb91f1
add monthly rotation smoke test
Aug 30, 2023
88603c2
fix rotation tests
Aug 31, 2023
3bfed55
refactor smoke test
Sep 5, 2023
e56c57c
refactor shiftLengthHours to shiftLength
Sep 5, 2023
16d580d
Merge branch 'master' into feat/monthly-rotation
allending313 Sep 5, 2023
0636ae1
fix webhook expansion when slack is disabled (#3264)
mastercactapus Sep 6, 2023
d0e77bb
dev: add local db url to dev setup guide (#3266)
mastercactapus Sep 11, 2023
99a3fea
Bump react-redux from 8.1.1 to 8.1.2 (#3269)
dependabot[bot] Sep 11, 2023
a94f5ca
Bump eslint-plugin-import from 2.27.5 to 2.28.1 (#3268)
dependabot[bot] Sep 11, 2023
97b48e7
Bump actions/checkout from 3 to 4 (#3267)
dependabot[bot] Sep 11, 2023
f87b409
preserve field/type information when parsing ISODuration (#3272)
mastercactapus Sep 11, 2023
e573204
add monthly rotation feat
Aug 21, 2023
9a934a8
update db-schema
Aug 22, 2023
86f0185
revert migration update, create new migration
Aug 22, 2023
1b9c21b
update monthly rotation logic
Aug 24, 2023
d79ae0f
make db-schema && make generate
Forfold Aug 28, 2023
ba0c05e
refactor monthly rotation api
Sep 11, 2023
82aee09
fix rotation test
Sep 11, 2023
57600be
Merge branch 'master' into feat/monthly-rotation
mastercactapus Sep 11, 2023
23ca07b
move new migration to the end
mastercactapus Sep 11, 2023
148c36b
cleanup CalcRotationHandoffTimes and fix missing Start
mastercactapus Sep 12, 2023
4083e38
add missing validation and fix error
mastercactapus Sep 12, 2023
839c447
fix deprecation warning
mastercactapus Sep 12, 2023
430c9a3
polish
mastercactapus Sep 12, 2023
1b19bc9
revert whitespace change (will fail on CI otherwise)
mastercactapus Sep 12, 2023
e7721aa
fix schema.sql out of date
Sep 12, 2023
882659d
add comments to new rotation logic
Sep 12, 2023
498eaab
minor fixes for clarity
Sep 13, 2023
22bbec1
revert timeFormat test corrections
Sep 13, 2023
58c096a
fix page crash if rotation is monthly
mastercactapus Sep 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion devtools/resetdb/datagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

var (
timeZones = []string{"America/Chicago", "Europe/Berlin", "UTC"}
rotationTypes = []rotation.Type{rotation.TypeDaily, rotation.TypeHourly, rotation.TypeWeekly}
rotationTypes = []rotation.Type{rotation.TypeDaily, rotation.TypeHourly, rotation.TypeWeekly, rotation.TypeMonthly}
)

type AlertLog struct {
Expand Down
7 changes: 4 additions & 3 deletions gadb/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions graphql2/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions graphql2/graphqlapp/rotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ func (a *Query) CalcRotationHandoffTimes(ctx context.Context, input *graphql2.Ca
err = validate.Many(
err,
validate.Range("count", input.Count, 0, 20),
validate.Range("hours", input.ShiftLengthHours, 0, 99999),
validate.Range("hours", input.ShiftLength, 0, 99999),
validate.OneOf("type", input.ShiftType, rotation.TypeMonthly, rotation.TypeWeekly, rotation.TypeDaily, rotation.TypeHourly),
)
if err != nil {
return result, err
Expand All @@ -397,8 +398,8 @@ func (a *Query) CalcRotationHandoffTimes(ctx context.Context, input *graphql2.Ca

rot := &rotation.Rotation{
Start: input.Handoff.In(loc),
ShiftLength: input.ShiftLengthHours,
Type: rotation.TypeHourly,
ShiftLength: input.ShiftLength,
Type: input.ShiftType,
}

t := time.Now()
Expand Down
11 changes: 6 additions & 5 deletions graphql2/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion graphql2/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ type Rotation {
}

enum RotationType {
monthly
weekly
daily
hourly
Expand Down Expand Up @@ -972,7 +973,8 @@ input CalcRotationHandoffTimesInput {
handoff: ISOTimestamp!
from: ISOTimestamp
timeZone: String!
shiftLengthHours: Int!
shiftLength: Int!
shiftType: RotationType!
allending313 marked this conversation as resolved.
Show resolved Hide resolved
count: Int!
}

Expand Down
1 change: 1 addition & 0 deletions migrate/migrations/20170530135027-schedule-rotation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ INSERT INTO schedules (id, name, description, time_zone)
SELECT id::UUID, name, description, 'America/Chicago' FROM schedule;

CREATE TYPE enum_rotation_type AS ENUM (
'monthly',
allending313 marked this conversation as resolved.
Show resolved Hide resolved
'weekly',
'daily',
'hourly'
Expand Down
Loading