-
-
Notifications
You must be signed in to change notification settings - Fork 554
Add swift-scheduling
exercise
#2536
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
Merged
+224
−0
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
964b868
Add `swift-scheduling` exercise
ErikSchierboom 0f7017a
Update introduction.md
ErikSchierboom e9ed1e7
Update instructions.md
ErikSchierboom 193d3b2
Update instructions.md
ErikSchierboom 6e16f19
Update instructions.md
ErikSchierboom cf93143
Update instructions.md
ErikSchierboom 7251584
Update instructions.md
ErikSchierboom d88ffc0
Fix formatting
ErikSchierboom 338fc9c
Add instructions for quarter and month
ErikSchierboom f48d397
Add test cases
ErikSchierboom 8e6a8c5
Fix duplicate uuid
ErikSchierboom 6d7a4b9
Fix HTML
ErikSchierboom 83b52b4
Explain quarters
ErikSchierboom 1bf08ed
Minor tweak to quarters
ErikSchierboom 7f6b1aa
Fix iso date
ErikSchierboom dd71883
Fix data
ErikSchierboom 74bf189
Fix eow
ErikSchierboom 2999e76
Update noon to 13:00
ErikSchierboom 2a5a746
Add leap day test case
ErikSchierboom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
{ | ||
"exercise": "swift-scheduling", | ||
"comments": [ | ||
"The dates are formatted per ", | ||
"https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15.", | ||
"", | ||
"Tracks that support changing the system's current time can consider ", | ||
"setting the system's current time to the meeting start instead of ", | ||
"passing it as an argument." | ||
], | ||
"cases": [ | ||
{ | ||
"uuid": "1d0e6e72-f370-408c-bc64-5dafa9c6da73", | ||
"description": "NOW translates to two hours later", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2012-02-13T09:00:00", | ||
"description": "NOW" | ||
}, | ||
"expected": "2012-02-13T11:00:00" | ||
}, | ||
{ | ||
"uuid": "93325e7b-677d-4d96-b017-2582af879dc2", | ||
"description": "ASAP before one in the afternoon translates to today at five in the afternoon", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "1999-06-03T09:45:00", | ||
"description": "ASAP" | ||
}, | ||
"expected": "1999-06-03T17:00:00" | ||
}, | ||
{ | ||
"uuid": "cb4252a3-c4c1-41f6-8b8c-e7269733cef8", | ||
"description": "ASAP at one in the afternoon translates to tomorrow at one in the afternoon", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2008-12-21T13:00:00", | ||
"description": "ASAP" | ||
}, | ||
"expected": "2008-12-22T13:00:00" | ||
}, | ||
{ | ||
"uuid": "6fddc1ea-2fe9-4c60-81f7-9220d2f45537", | ||
"description": "ASAP after one in the afternoon translates to tomorrow at one in the afternoon", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2008-12-21T14:50:00", | ||
"description": "ASAP" | ||
}, | ||
"expected": "2008-12-22T13:00:00" | ||
}, | ||
{ | ||
"uuid": "25f46bf9-6d2a-4e95-8edd-f62dd6bc8a6e", | ||
"description": "EOW on Monday translates to Friday at five in the afternoon", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2025-02-03T16:00:00", | ||
"description": "EOW" | ||
}, | ||
"expected": "2025-02-07T17:00:00" | ||
}, | ||
{ | ||
"uuid": "0b375df5-d198-489e-acee-fd538a768616", | ||
"description": "EOW on Tuesday translates to Friday at five in the afternoon", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "1997-04-29T10:50:00", | ||
"description": "EOW" | ||
}, | ||
"expected": "1997-05-02T17:00:00" | ||
}, | ||
{ | ||
"uuid": "4afbb881-0b5c-46be-94e1-992cdc2a8ca4", | ||
"description": "EOW on Wednesday translates to Friday at five in the afternoon", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2005-09-14T11:00:00", | ||
"description": "EOW" | ||
}, | ||
"expected": "2005-09-16T17:00:00" | ||
}, | ||
{ | ||
"uuid": "e1341c2b-5e1b-4702-a95c-a01e8e96e510", | ||
"description": "EOW on Thursday translates to Sunday at eight in the evening", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2011-05-19T08:30:00", | ||
"description": "EOW" | ||
}, | ||
"expected": "2011-05-22T20:00:00" | ||
}, | ||
{ | ||
"uuid": "bbffccf7-97f7-4244-888d-bdd64348fa2e", | ||
"description": "EOW on Friday translates to Sunday at eight in the evening", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2022-08-05T14:00:00", | ||
"description": "EOW" | ||
}, | ||
"expected": "2022-08-07T20:00:00" | ||
}, | ||
{ | ||
"uuid": "d651fcf4-290e-407c-8107-36b9076f39b2", | ||
"description": "EOW translates to leap day", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2008-02-25T10:30:00", | ||
"description": "EOW" | ||
}, | ||
"expected": "2008-02-29T17:00:00" | ||
}, | ||
{ | ||
"uuid": "439bf09f-3a0e-44e7-bad5-b7b6d0c4505a", | ||
"description": "2M before the second month of this year translates to the first workday of the second month of this year", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2007-01-02T14:15:00", | ||
"description": "2M" | ||
}, | ||
"expected": "2007-02-01T08:00:00" | ||
}, | ||
{ | ||
"uuid": "86d82e83-c481-4fb4-9264-625de7521340", | ||
"description": "11M in the eleventh month translates to the first workday of the eleventh month of next year", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2013-11-21T15:30:00", | ||
"description": "11M" | ||
}, | ||
"expected": "2014-11-03T08:00:00" | ||
}, | ||
{ | ||
"uuid": "0d0b8f6a-1915-46f5-a630-1ff06af9da08", | ||
"description": "4M in the ninth month translates to the first workday of the fourth month of next year", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2019-11-18T15:15:00", | ||
"description": "4M" | ||
}, | ||
"expected": "2020-04-01T08:00:00" | ||
}, | ||
{ | ||
"uuid": "06d401e3-8461-438f-afae-8d26aa0289e0", | ||
"description": "Q1 in the first quarter translates to the last workday of the first quarter of this year", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2003-01-01T10:45:00", | ||
"description": "Q1" | ||
}, | ||
"expected": "2003-03-31T08:00:00" | ||
}, | ||
{ | ||
"uuid": "eebd5f32-b16d-4ecd-91a0-584b0364b7ed", | ||
"description": "Q4 in the second quarter translates to the last workday of the fourth quarter of this year", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2001-04-09T09:00:00", | ||
"description": "Q4" | ||
}, | ||
"expected": "2001-12-31T08:00:00" | ||
}, | ||
{ | ||
"uuid": "c920886c-44ad-4d34-a156-dc4176186581", | ||
"description": "Q3 in the fourth quarter translates to the last workday of the third quarter of next year", | ||
"property": "deliveryDate", | ||
"input": { | ||
"meetingStart": "2022-10-06T11:00:00", | ||
"description": "Q3" | ||
}, | ||
"expected": "2023-09-29T08:00:00" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Instructions | ||
|
||
Your task is to convert delivery date descriptions to _actual_ delivery dates, based on when the meeting started. | ||
|
||
There are two types of delivery date descriptions: | ||
|
||
1. Fixed: a predefined set of words. | ||
2. Variable: words that have a variable component, but follow a predefined set of patterns. | ||
|
||
## Fixed delivery date descriptions | ||
|
||
There are three fixed delivery date descriptions: | ||
|
||
- `"NOW"` | ||
- `"ASAP"` (As Soon As Possible) | ||
- `"EOW"` (End Of Week) | ||
|
||
The following table shows how to translate them: | ||
|
||
| Description | Meeting start | Delivery date | | ||
| ----------- | ----------------------------- | ----------------------------------- | | ||
| `"NOW"` | - | Two hours after the meeting started | | ||
| `"ASAP"` | Before 13:00 | Today at 17:00 | | ||
| `"ASAP"` | After or at 13:00 | Tomorrow at 13:00 | | ||
| `"EOW"` | Monday, Tuesday, or Wednesday | Friday at 17:00 | | ||
| `"EOW"` | Thursday or Friday | Sunday at 20:00 | | ||
|
||
## Variable delivery date descriptions | ||
|
||
There are two variable delivery date description patterns: | ||
|
||
- `"<N>M"` (N-th month) | ||
- `"Q<N>"` (N-th quarter) | ||
|
||
| Description | Meeting start | Delivery date | | ||
| ----------- | -------------------------- | ----------------------------------------------------------- | | ||
| `"<N>M"` | Before N-th month | At 8:00 on the _first_ workday¹ of this year's N-th month | | ||
| `"<N>M"` | After or in N-th month | At 8:00 on the _first_ workday¹ of next year's N-th month | | ||
| `"Q<N>"` | Before or in N-th quarter² | At 8:00 on the _last_ workday¹ of this year's N-th quarter² | | ||
| `"Q<N>"` | After N-th quarter² | At 8:00 on the _last_ workday¹ of next year's N-th quarter² | | ||
|
||
¹ A workday is a Monday, Tuesday, Wednesday, Thursday, or Friday. | ||
² A year has four quarters, each with three months: January/February/March, April/May/June, July/August/September, and October/November/December. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Introduction | ||
|
||
This week, it is your turn to take notes in the department's planning meeting. | ||
In this meeting, your boss will set delivery dates for all open work items. | ||
Annoyingly, instead of specifying the _actual_ delivery dates, your boss will only _describe them_ in an abbreviated format. | ||
As many of your colleagues won't be familiar with this corporate lingo, you'll need to convert these delivery date descriptions to actual delivery dates. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
title = "Swift Scheduling" | ||
blurb = "Convert delivery date descriptions to actual delivery dates." |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.