From 1cc6139d9b5eb2605cd77a51f1a7d9dc5a063eac Mon Sep 17 00:00:00 2001 From: Huy Nguyen Vu Date: Fri, 22 Dec 2023 03:14:02 +0700 Subject: [PATCH] Update-dev: quickstart readme --- README.md | 132 +++++++++++++++++++++- requirements.txt | 162 +++++++++++++++++++++++++++ tests/test_objects/shifts_builder.py | 10 +- tests/test_shifts_builder.py | 6 +- 4 files changed, 300 insertions(+), 10 deletions(-) create mode 100644 requirements.txt diff --git a/README.md b/README.md index 0133179..985c116 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,130 @@ -# pysla - SLA Calculator and Work Shift Generator in Python - Highly customizable SLA calculator and Work shift Generator, for any time-keeping and days-off policies \ No newline at end of file +# pysla + Highly customizable SLA calculator and Work shift Generator, for any time-keeping and days-off policies +--- +### Quickstart - A case in Vietnam's Law: +- Let's calculate **SLA** and **generate work shifts** for an **American** female employee, Working in **Vietnam**, about to take maternity leave. +- Law references: [(1)][1]; [(2)][2] +#### 1. She will have: +- **4-month** of **maternity leave**. +- Holidays leave: + - All **Vietnamese holidays**. + - **1 day** from home country's **New Year**'s days (2024-01-01) (same as Solar New Year in Vietnam) (+0 holiday leave) + - **1 day** from home country's Independence Days (2024-07-04) (+1 holiday leave) +- **Overtime shift** in the **Solar New Year**: from 13:30 to 14:30 +- Plus random **3 days off** + +#### 2. Configuration for `ShiftsBuilder` +```python +from pysla.shifts_builder import ShiftsBuilder, Shift, DateRange +from datetime import time, date + +US_WOMAN_LIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024 = ShiftsBuilder( + workdays_weekly=[0,1,2,3,4], # weekday indexes: Monday to Friday + daily_shifts=DailyShift([ + # Usual Morning shift: 8:30 to 11:45 + # Created using a string, easier to read but slower + Shift.fromstr("08301145"), + # Usual Afternoon shift: 13:30 to 18:00 + # Parsed the timestamps straight to parameters, faster + Shift(start=time(13,30), end=time(18)) + ]), + days_off_ranges=[ # you can parse `date` or `DateRange` + date(2024, 1, 1), # SOLAR_NEW_YEAR + date(2024, 7, 4), # US_INDEPENDENCE_DAY + DateRange.fromstr("20240430-20240501"), #VIETNAM_VICTORY_DAY + DateRange.fromstr("20240902-20240903"), #VIETNAM_INDEPENDENCE_DAY + #VIETNAMESE_LUNAR_NEW_YEAR, Lunar DateRange will automatically turn into Solar DateRange + DateRange.fromstr("20240101-20240105", calendar_type="lunar") + #VIETNAM_LUNAR_HUNG_KINGS_FESTIVAL + DateRange.fromstr("20240310", calendar_type="lunar") + + # 4 months of maternity leave + DateRange.fromstr("20240801-20241201"), + + date(2024, 2, 9), # custom days off + date(2024, 6, 3), # custom days off + date(2024, 12, 10), # custom days off + ], + special_shifts=ShiftRange( + { + # Urgent overtime in the Solar New Year + # 13:30 to 14:30 + date(2024, 1, 1): DailyShift([Shift.fromstr("13301430")]), + } + ), +) +``` + +#### 3. Generate `ShiftRange` for year 2024 +- `ShiftRange` works like a dictionary, and can check the generated `Shift` at a specific `date`. +```python +generated_shiftrange = ( # ShiftRange for 2024 + US_WOMAN_LIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024 + .build_shifts_from_daterange( + from_date=date(2024, 1, 1), + to_date=date(2024, 12, 30)) + ) +# Get Shifts in New Year 2024-01-01 +generated_shiftrange[date(2024,1,1)] +# [Shift(start=datetime.time(13, 30), end=datetime.time(14, 30))] + +# Get Shifts in a random working day +generated_shiftrange[date(2024,2,8)] +# [ +# Shift(start=datetime.time(8, 30), end=datetime.time(11, 45)), +# Shift(start=datetime.time(13, 30), end=datetime.time(18, 0)) +# ] + +# Get Shifts in a day off (holiday leave) 2024-07-04 +# KeyError: datetime.date(2024, 2, 9) +generated_shiftrange[date(2024,7,4)] +generated_shiftrange.get(date(2024,7,4)) # None +``` + +#### 4. Calculate SLA (service-level agreement) +- The result will be in `Milliseconds`: +```python +sla_millis = ( + US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024 + .calculate_sla( + start_deal=datetime(2024, 1, 1, 14), + end_deal=datetime(2024, 1, 2, 9, 30), + use_generated_shifts=True, # for faster execution, + # reuse the cached results from `build_shifts_from_daterange`, + # if "False", set re-generated `ShiftsRange` from `start_deal` to `end_deal` + ) +) +sla_hours = sla_millis/(1000*60*60) # 1.5 hours +``` + + +### Global `ShiftsBuilder` config for your company/team +```python +from pysla.shifts_builder import ShiftsBuilder, Shift +from datetime import time + +COMPANY_SHIFTS_BUILDER = ShiftsBuilder( + daily_shifts=DailyShift([ + Shift.fromstr("08301145"), # morning shift, created using a string, easier to read but slower + Shift(start=time(13,30), end=time(18)) # afternoon shift, parsed the timestamps straight to parameters, faster + ]), + workdays_weekly=[0,1,2,3,4] # Monday to Friday +) +``` +- Copy config to a specific `employee`. +```python +employee_takes_4_days_off = ( + COMPANY_SHIFTS_BUILDER + .add_days_off_range( + [ + DateRange.fromstr("20241204-20241205"), # 2days off + DateRange.fromstr("20241000-20241001") # 2days off + ], + inplace=False # if `False` will return a copied `ShiftsBuilder`, + # if `True`, will change `COMPANY_SHIFTS_BUILDER` and return `None` + )) +``` + + +[1]:https://english.luatvietnam.vn/legal-news/public-holiday-leaves-of-foreign-employees-in-vietnam-4729-91710-article.html +[2]: https://vietnamlawmagazine.vn/maternity-leave-for-foreign-female-employees-6115.html \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2ea7100 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,162 @@ +annotated-types==0.6.0 ; python_version >= "3.10" and python_version < "4.0" \ + --hash=sha256:0641064de18ba7a25dee8f96403ebc39113d0cb953a01429249d5c7564666a43 \ + --hash=sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d +lunardate==0.2.2 ; python_version >= "3.10" and python_version < "4.0" \ + --hash=sha256:8ff8c01721bef7710f0712a302b1cb7d0b8b3ffc72a63a9a056cd01e58e5485a \ + --hash=sha256:cf1916337e50470a82df12d885ff47a456e89c91a3ad4e5fdf1575e063a7ed55 +numpy==1.26.2 ; python_version >= "3.10" and python_version < "4.0" \ + --hash=sha256:06fa1ed84aa60ea6ef9f91ba57b5ed963c3729534e6e54055fc151fad0423f0a \ + --hash=sha256:174a8880739c16c925799c018f3f55b8130c1f7c8e75ab0a6fa9d41cab092fd6 \ + --hash=sha256:1a13860fdcd95de7cf58bd6f8bc5a5ef81c0b0625eb2c9a783948847abbef2c2 \ + --hash=sha256:1cc3d5029a30fb5f06704ad6b23b35e11309491c999838c31f124fee32107c79 \ + --hash=sha256:22f8fc02fdbc829e7a8c578dd8d2e15a9074b630d4da29cda483337e300e3ee9 \ + --hash=sha256:26c9d33f8e8b846d5a65dd068c14e04018d05533b348d9eaeef6c1bd787f9919 \ + --hash=sha256:2b3fca8a5b00184828d12b073af4d0fc5fdd94b1632c2477526f6bd7842d700d \ + --hash=sha256:2beef57fb031dcc0dc8fa4fe297a742027b954949cabb52a2a376c144e5e6060 \ + --hash=sha256:36340109af8da8805d8851ef1d74761b3b88e81a9bd80b290bbfed61bd2b4f75 \ + --hash=sha256:3703fc9258a4a122d17043e57b35e5ef1c5a5837c3db8be396c82e04c1cf9b0f \ + --hash=sha256:3ced40d4e9e18242f70dd02d739e44698df3dcb010d31f495ff00a31ef6014fe \ + --hash=sha256:4a06263321dfd3598cacb252f51e521a8cb4b6df471bb12a7ee5cbab20ea9167 \ + --hash=sha256:4eb8df4bf8d3d90d091e0146f6c28492b0be84da3e409ebef54349f71ed271ef \ + --hash=sha256:5d5244aabd6ed7f312268b9247be47343a654ebea52a60f002dc70c769048e75 \ + --hash=sha256:64308ebc366a8ed63fd0bf426b6a9468060962f1a4339ab1074c228fa6ade8e3 \ + --hash=sha256:6a3cdb4d9c70e6b8c0814239ead47da00934666f668426fc6e94cce869e13fd7 \ + --hash=sha256:854ab91a2906ef29dc3925a064fcd365c7b4da743f84b123002f6139bcb3f8a7 \ + --hash=sha256:94cc3c222bb9fb5a12e334d0479b97bb2df446fbe622b470928f5284ffca3f8d \ + --hash=sha256:96ca5482c3dbdd051bcd1fce8034603d6ebfc125a7bd59f55b40d8f5d246832b \ + --hash=sha256:a2bbc29fcb1771cd7b7425f98b05307776a6baf43035d3b80c4b0f29e9545186 \ + --hash=sha256:a4cd6ed4a339c21f1d1b0fdf13426cb3b284555c27ac2f156dfdaaa7e16bfab0 \ + --hash=sha256:aa18428111fb9a591d7a9cc1b48150097ba6a7e8299fb56bdf574df650e7d1f1 \ + --hash=sha256:aa317b2325f7aa0a9471663e6093c210cb2ae9c0ad824732b307d2c51983d5b6 \ + --hash=sha256:b04f5dc6b3efdaab541f7857351aac359e6ae3c126e2edb376929bd3b7f92d7e \ + --hash=sha256:b272d4cecc32c9e19911891446b72e986157e6a1809b7b56518b4f3755267523 \ + --hash=sha256:b361d369fc7e5e1714cf827b731ca32bff8d411212fccd29ad98ad622449cc36 \ + --hash=sha256:b96e7b9c624ef3ae2ae0e04fa9b460f6b9f17ad8b4bec6d7756510f1f6c0c841 \ + --hash=sha256:baf8aab04a2c0e859da118f0b38617e5ee65d75b83795055fb66c0d5e9e9b818 \ + --hash=sha256:bcc008217145b3d77abd3e4d5ef586e3bdfba8fe17940769f8aa09b99e856c00 \ + --hash=sha256:bd3f0091e845164a20bd5a326860c840fe2af79fa12e0469a12768a3ec578d80 \ + --hash=sha256:cc392fdcbd21d4be6ae1bb4475a03ce3b025cd49a9be5345d76d7585aea69440 \ + --hash=sha256:d73a3abcac238250091b11caef9ad12413dab01669511779bc9b29261dd50210 \ + --hash=sha256:f43740ab089277d403aa07567be138fc2a89d4d9892d113b76153e0e412409f8 \ + --hash=sha256:f65738447676ab5777f11e6bbbdb8ce11b785e105f690bc45966574816b6d3ea \ + --hash=sha256:f79b231bf5c16b1f39c7f4875e1ded36abee1591e98742b05d8a0fb55d8a3eec \ + --hash=sha256:fe6b44fb8fcdf7eda4ef4461b97b3f63c466b27ab151bec2366db8b197387841 +polars==0.20.2 ; python_version >= "3.10" and python_version < "4.0" \ + --hash=sha256:38d304d532d7bf7f5fb8b878924bf1580ea83aa2f81c7dcd65f8c722fc29e6f9 \ + --hash=sha256:41ed711851745fda2433070d094ca6d21a340940b1641190f7b05c757c11bf1a \ + --hash=sha256:483562f157e6aef6cb4343bf13d11295c8bff55ee62fef8010975a5fc22ff4e0 \ + --hash=sha256:7a4e88681e491090435a3c859df7a52d55e6d6ce2891cd404b1668959cfaaebf \ + --hash=sha256:a3c4f67573147c2af87c705d4ffd295b865f7e28c88884f7739fb364607e0cd0 \ + --hash=sha256:bb49b19e817deb50655b52302c0dbeb099cfe7d2e4c40a6595e7bd94450bf192 +pydantic-core==2.14.5 ; python_version >= "3.10" and python_version < "4.0" \ + --hash=sha256:038c9f763e650712b899f983076ce783175397c848da04985658e7628cbe873b \ + --hash=sha256:074f3d86f081ce61414d2dc44901f4f83617329c6f3ab49d2bc6c96948b2c26b \ + --hash=sha256:079206491c435b60778cf2b0ee5fd645e61ffd6e70c47806c9ed51fc75af078d \ + --hash=sha256:09b0e985fbaf13e6b06a56d21694d12ebca6ce5414b9211edf6f17738d82b0f8 \ + --hash=sha256:0f6116a558fd06d1b7c2902d1c4cf64a5bd49d67c3540e61eccca93f41418124 \ + --hash=sha256:103ef8d5b58596a731b690112819501ba1db7a36f4ee99f7892c40da02c3e189 \ + --hash=sha256:16e29bad40bcf97aac682a58861249ca9dcc57c3f6be22f506501833ddb8939c \ + --hash=sha256:206ed23aecd67c71daf5c02c3cd19c0501b01ef3cbf7782db9e4e051426b3d0d \ + --hash=sha256:2248485b0322c75aee7565d95ad0e16f1c67403a470d02f94da7344184be770f \ + --hash=sha256:27548e16c79702f1e03f5628589c6057c9ae17c95b4c449de3c66b589ead0520 \ + --hash=sha256:2d0ae0d8670164e10accbeb31d5ad45adb71292032d0fdb9079912907f0085f4 \ + --hash=sha256:3128e0bbc8c091ec4375a1828d6118bc20404883169ac95ffa8d983b293611e6 \ + --hash=sha256:3387277f1bf659caf1724e1afe8ee7dbc9952a82d90f858ebb931880216ea955 \ + --hash=sha256:34708cc82c330e303f4ce87758828ef6e457681b58ce0e921b6e97937dd1e2a3 \ + --hash=sha256:35613015f0ba7e14c29ac6c2483a657ec740e5ac5758d993fdd5870b07a61d8b \ + --hash=sha256:3ad873900297bb36e4b6b3f7029d88ff9829ecdc15d5cf20161775ce12306f8a \ + --hash=sha256:40180930807ce806aa71eda5a5a5447abb6b6a3c0b4b3b1b1962651906484d68 \ + --hash=sha256:439c9afe34638ace43a49bf72d201e0ffc1a800295bed8420c2a9ca8d5e3dbb3 \ + --hash=sha256:45e95333b8418ded64745f14574aa9bfc212cb4fbeed7a687b0c6e53b5e188cd \ + --hash=sha256:4641e8ad4efb697f38a9b64ca0523b557c7931c5f84e0fd377a9a3b05121f0de \ + --hash=sha256:49b08aae5013640a3bfa25a8eebbd95638ec3f4b2eaf6ed82cf0c7047133f03b \ + --hash=sha256:4bc536201426451f06f044dfbf341c09f540b4ebdb9fd8d2c6164d733de5e634 \ + --hash=sha256:4ce601907e99ea5b4adb807ded3570ea62186b17f88e271569144e8cca4409c7 \ + --hash=sha256:4e40f2bd0d57dac3feb3a3aed50f17d83436c9e6b09b16af271b6230a2915459 \ + --hash=sha256:4e47a76848f92529879ecfc417ff88a2806438f57be4a6a8bf2961e8f9ca9ec7 \ + --hash=sha256:513b07e99c0a267b1d954243845d8a833758a6726a3b5d8948306e3fe14675e3 \ + --hash=sha256:531f4b4252fac6ca476fbe0e6f60f16f5b65d3e6b583bc4d87645e4e5ddde331 \ + --hash=sha256:57d52fa717ff445cb0a5ab5237db502e6be50809b43a596fb569630c665abddf \ + --hash=sha256:59986de5710ad9613ff61dd9b02bdd2f615f1a7052304b79cc8fa2eb4e336d2d \ + --hash=sha256:5baab5455c7a538ac7e8bf1feec4278a66436197592a9bed538160a2e7d11e36 \ + --hash=sha256:5c7d5b5005f177764e96bd584d7bf28d6e26e96f2a541fdddb934c486e36fd59 \ + --hash=sha256:60b7607753ba62cf0739177913b858140f11b8af72f22860c28eabb2f0a61937 \ + --hash=sha256:615a0a4bff11c45eb3c1996ceed5bdaa2f7b432425253a7c2eed33bb86d80abc \ + --hash=sha256:61ea96a78378e3bd5a0be99b0e5ed00057b71f66115f5404d0dae4819f495093 \ + --hash=sha256:652c1988019752138b974c28f43751528116bcceadad85f33a258869e641d753 \ + --hash=sha256:6637560562134b0e17de333d18e69e312e0458ee4455bdad12c37100b7cad706 \ + --hash=sha256:678265f7b14e138d9a541ddabbe033012a2953315739f8cfa6d754cc8063e8ca \ + --hash=sha256:699156034181e2ce106c89ddb4b6504c30db8caa86e0c30de47b3e0654543260 \ + --hash=sha256:6b9ff467ffbab9110e80e8c8de3bcfce8e8b0fd5661ac44a09ae5901668ba997 \ + --hash=sha256:6c327e9cd849b564b234da821236e6bcbe4f359a42ee05050dc79d8ed2a91588 \ + --hash=sha256:6d30226dfc816dd0fdf120cae611dd2215117e4f9b124af8c60ab9093b6e8e71 \ + --hash=sha256:6e227c40c02fd873c2a73a98c1280c10315cbebe26734c196ef4514776120aeb \ + --hash=sha256:6e4d090e73e0725b2904fdbdd8d73b8802ddd691ef9254577b708d413bf3006e \ + --hash=sha256:70f4b4851dbb500129681d04cc955be2a90b2248d69273a787dda120d5cf1f69 \ + --hash=sha256:70f947628e074bb2526ba1b151cee10e4c3b9670af4dbb4d73bc8a89445916b5 \ + --hash=sha256:774de879d212db5ce02dfbf5b0da9a0ea386aeba12b0b95674a4ce0593df3d07 \ + --hash=sha256:77fa384d8e118b3077cccfcaf91bf83c31fe4dc850b5e6ee3dc14dc3d61bdba1 \ + --hash=sha256:79e0a2cdbdc7af3f4aee3210b1172ab53d7ddb6a2d8c24119b5706e622b346d0 \ + --hash=sha256:7e88f5696153dc516ba6e79f82cc4747e87027205f0e02390c21f7cb3bd8abfd \ + --hash=sha256:7f8210297b04e53bc3da35db08b7302a6a1f4889c79173af69b72ec9754796b8 \ + --hash=sha256:81982d78a45d1e5396819bbb4ece1fadfe5f079335dd28c4ab3427cd95389944 \ + --hash=sha256:823fcc638f67035137a5cd3f1584a4542d35a951c3cc68c6ead1df7dac825c26 \ + --hash=sha256:853a2295c00f1d4429db4c0fb9475958543ee80cfd310814b5c0ef502de24dda \ + --hash=sha256:88e74ab0cdd84ad0614e2750f903bb0d610cc8af2cc17f72c28163acfcf372a4 \ + --hash=sha256:8aa1768c151cf562a9992462239dfc356b3d1037cc5a3ac829bb7f3bda7cc1f9 \ + --hash=sha256:8c8a8812fe6f43a3a5b054af6ac2d7b8605c7bcab2804a8a7d68b53f3cd86e00 \ + --hash=sha256:95b15e855ae44f0c6341ceb74df61b606e11f1087e87dcb7482377374aac6abe \ + --hash=sha256:96581cfefa9123accc465a5fd0cc833ac4d75d55cc30b633b402e00e7ced00a6 \ + --hash=sha256:9bd18fee0923ca10f9a3ff67d4851c9d3e22b7bc63d1eddc12f439f436f2aada \ + --hash=sha256:a33324437018bf6ba1bb0f921788788641439e0ed654b233285b9c69704c27b4 \ + --hash=sha256:a6a16f4a527aae4f49c875da3cdc9508ac7eef26e7977952608610104244e1b7 \ + --hash=sha256:a717aef6971208f0851a2420b075338e33083111d92041157bbe0e2713b37325 \ + --hash=sha256:a71891847f0a73b1b9eb86d089baee301477abef45f7eaf303495cd1473613e4 \ + --hash=sha256:aae7ea3a1c5bb40c93cad361b3e869b180ac174656120c42b9fadebf685d121b \ + --hash=sha256:ab1cdb0f14dc161ebc268c09db04d2c9e6f70027f3b42446fa11c153521c0e88 \ + --hash=sha256:ab4ea451082e684198636565224bbb179575efc1658c48281b2c866bfd4ddf04 \ + --hash=sha256:abf058be9517dc877227ec3223f0300034bd0e9f53aebd63cf4456c8cb1e0863 \ + --hash=sha256:af36f36538418f3806048f3b242a1777e2540ff9efaa667c27da63d2749dbce0 \ + --hash=sha256:b53e9ad053cd064f7e473a5f29b37fc4cc9dc6d35f341e6afc0155ea257fc911 \ + --hash=sha256:b7851992faf25eac90bfcb7bfd19e1f5ffa00afd57daec8a0042e63c74a4551b \ + --hash=sha256:b9b759b77f5337b4ea024f03abc6464c9f35d9718de01cfe6bae9f2e139c397e \ + --hash=sha256:ba39688799094c75ea8a16a6b544eb57b5b0f3328697084f3f2790892510d144 \ + --hash=sha256:ba6b6b3846cfc10fdb4c971980a954e49d447cd215ed5a77ec8190bc93dd7bc5 \ + --hash=sha256:bb4c2eda937a5e74c38a41b33d8c77220380a388d689bcdb9b187cf6224c9720 \ + --hash=sha256:c0b97ec434041827935044bbbe52b03d6018c2897349670ff8fe11ed24d1d4ab \ + --hash=sha256:c1452a1acdf914d194159439eb21e56b89aa903f2e1c65c60b9d874f9b950e5d \ + --hash=sha256:c2027d05c8aebe61d898d4cffd774840a9cb82ed356ba47a90d99ad768f39789 \ + --hash=sha256:c2adbe22ab4babbca99c75c5d07aaf74f43c3195384ec07ccbd2f9e3bddaecec \ + --hash=sha256:c2d97e906b4ff36eb464d52a3bc7d720bd6261f64bc4bcdbcd2c557c02081ed2 \ + --hash=sha256:c339dabd8ee15f8259ee0f202679b6324926e5bc9e9a40bf981ce77c038553db \ + --hash=sha256:c6eae413494a1c3f89055da7a5515f32e05ebc1a234c27674a6956755fb2236f \ + --hash=sha256:c949f04ecad823f81b1ba94e7d189d9dfb81edbb94ed3f8acfce41e682e48cef \ + --hash=sha256:c97bee68898f3f4344eb02fec316db93d9700fb1e6a5b760ffa20d71d9a46ce3 \ + --hash=sha256:ca61d858e4107ce5e1330a74724fe757fc7135190eb5ce5c9d0191729f033209 \ + --hash=sha256:cb4679d4c2b089e5ef89756bc73e1926745e995d76e11925e3e96a76d5fa51fc \ + --hash=sha256:cb774298da62aea5c80a89bd58c40205ab4c2abf4834453b5de207d59d2e1651 \ + --hash=sha256:ccd4d5702bb90b84df13bd491be8d900b92016c5a455b7e14630ad7449eb03f8 \ + --hash=sha256:cf9d3fe53b1ee360e2421be95e62ca9b3296bf3f2fb2d3b83ca49ad3f925835e \ + --hash=sha256:d2ae91f50ccc5810b2f1b6b858257c9ad2e08da70bf890dee02de1775a387c66 \ + --hash=sha256:d37f8ec982ead9ba0a22a996129594938138a1503237b87318392a48882d50b7 \ + --hash=sha256:d81e6987b27bc7d101c8597e1cd2bcaa2fee5e8e0f356735c7ed34368c471550 \ + --hash=sha256:dcf4e6d85614f7a4956c2de5a56531f44efb973d2fe4a444d7251df5d5c4dcfd \ + --hash=sha256:de790a3b5aa2124b8b78ae5faa033937a72da8efe74b9231698b5a1dd9be3405 \ + --hash=sha256:e47e9a08bcc04d20975b6434cc50bf82665fbc751bcce739d04a3120428f3e27 \ + --hash=sha256:e60f112ac88db9261ad3a52032ea46388378034f3279c643499edb982536a093 \ + --hash=sha256:e87fc540c6cac7f29ede02e0f989d4233f88ad439c5cdee56f693cc9c1c78077 \ + --hash=sha256:eac5c82fc632c599f4639a5886f96867ffced74458c7db61bc9a66ccb8ee3113 \ + --hash=sha256:ebb4e035e28f49b6f1a7032920bb9a0c064aedbbabe52c543343d39341a5b2a3 \ + --hash=sha256:ec1e72d6412f7126eb7b2e3bfca42b15e6e389e1bc88ea0069d0cc1742f477c6 \ + --hash=sha256:ef98ca7d5995a82f43ec0ab39c4caf6a9b994cb0b53648ff61716370eadc43cf \ + --hash=sha256:f0cbc7fff06a90bbd875cc201f94ef0ee3929dfbd5c55a06674b60857b8b85ed \ + --hash=sha256:f4791cf0f8c3104ac668797d8c514afb3431bc3305f5638add0ba1a5a37e0d88 \ + --hash=sha256:f5e412d717366e0677ef767eac93566582518fe8be923361a5c204c1a62eaafe \ + --hash=sha256:fb2ed8b3fe4bf4506d6dab3b93b83bbc22237e230cba03866d561c3577517d18 \ + --hash=sha256:fe0a5a1025eb797752136ac8b4fa21aa891e3d74fd340f864ff982d649691867 +pydantic==2.5.2 ; python_version >= "3.10" and python_version < "4.0" \ + --hash=sha256:80c50fb8e3dcecfddae1adbcc00ec5822918490c99ab31f6cf6140ca1c1429f0 \ + --hash=sha256:ff177ba64c6faf73d7afa2e8cad38fd456c0dbe01c9954e71038001cd15a6edd +typing-extensions==4.9.0 ; python_version >= "3.10" and python_version < "4.0" \ + --hash=sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783 \ + --hash=sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd diff --git a/tests/test_objects/shifts_builder.py b/tests/test_objects/shifts_builder.py index e6d3ba5..947ee1f 100644 --- a/tests/test_objects/shifts_builder.py +++ b/tests/test_objects/shifts_builder.py @@ -32,7 +32,7 @@ - 1 day from home country's Independence Days (2024-07-04) (+1 holiday leave) - Overtime work in the Solar New Year: from 13:30 to 14:30 """ -US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024 = ( +US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024 = ( COMPANY_SHIFTS_BUILDER.partial_config_copy( days_off_ranges=[ SOLAR_NEW_YEAR, @@ -63,18 +63,18 @@ from icecream import ic # ic( - # US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024.get_days_off() + # US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024.get_days_off() # ) - US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024.build_shifts_from_daterange( + US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024.build_shifts_from_daterange( from_date=date(2024, 1, 1), to_date=date(2024, 12, 30) ) - generated_shifts = US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024.get_generated_shifts() + generated_shifts = US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024.get_generated_shifts() ic(generated_shifts[date(2024, 1, 2)]) ic(generated_shifts[date(2024, 1, 2)].total_milliseconds / (1000 * 3600)) ic( - US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024.calculate_sla( + US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024.calculate_sla( start_deal=datetime(2024, 1, 1, 14, 0), end_deal=datetime(2024, 1, 3, 9, 30), use_generated_shifts=True, diff --git a/tests/test_shifts_builder.py b/tests/test_shifts_builder.py index 9b3e7df..06f17b4 100644 --- a/tests/test_shifts_builder.py +++ b/tests/test_shifts_builder.py @@ -2,16 +2,16 @@ from tests.test_objects.manual import TEST_YEAR from tests.test_objects.shifts_builder import ( - US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024, + US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024, ) def test_shifts_builder(): - US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024.build_shifts_from_daterange( + US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024.build_shifts_from_daterange( from_date=date(TEST_YEAR, 1, 1), to_date=date(TEST_YEAR, 12, 30) ) millis_sla_new_year_day = ( - US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_6MONTHS_2024.calculate_sla( + US_WOMAN_lIVING_IN_VIETNAM_MATERNITY_LEAVE_4MONTHS_2024.calculate_sla( start_deal=datetime(TEST_YEAR, 1, 1, 14), end_deal=datetime(TEST_YEAR, 1, 2, 9, 30), use_generated_shifts=True,