webkom / lego

Backend for abakus.no
https://lego.abakus.no
MIT License
55 stars 20 forks source link

Implement new penalty rules #3349

Open Arashfa0301 opened 1 year ago

Arashfa0301 commented 1 year ago

Implement new rules and consequences for penalties. The changes are as following:

The biggest change is the addition of PenaltyGroup for the purpose of separating penalty consequence calculation logic and the the information used in front-end.

I have deleted some tests that believe are not needed for our new implementation and i have also made changes to events app that i deemed necessary. I would appreciate reviewing specially these changes as it might be possible that i made some mistakes.

Resolves ABA-92

codecov[bot] commented 1 year ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (1362f10) 88.30% compared to head (7a487fa) 88.26%. Report is 156 commits behind head on master.

:exclamation: Current head 7a487fa differs from pull request most recent head d531414. Consider uploading reports for the commit d531414 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3349 +/- ## ========================================== - Coverage 88.30% 88.26% -0.04% ========================================== Files 661 662 +1 Lines 20968 20786 -182 ========================================== - Hits 18515 18347 -168 + Misses 2453 2439 -14 ``` | [Files](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom) | Coverage Δ | | |---|---|---| | [lego/apps/events/models.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL2V2ZW50cy9tb2RlbHMucHk=) | `97.46% <100.00%> (+0.26%)` | :arrow_up: | | [lego/apps/events/tests/test\_async\_tasks.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL2V2ZW50cy90ZXN0cy90ZXN0X2FzeW5jX3Rhc2tzLnB5) | `93.65% <ø> (-0.43%)` | :arrow_down: | | [lego/apps/events/tests/test\_penalties.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL2V2ZW50cy90ZXN0cy90ZXN0X3BlbmFsdGllcy5weQ==) | `100.00% <100.00%> (ø)` | | | [lego/apps/users/action\_handlers.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL3VzZXJzL2FjdGlvbl9oYW5kbGVycy5weQ==) | `57.50% <ø> (ø)` | | | [...s/users/migrations/0039\_penalty\_activation\_time.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL3VzZXJzL21pZ3JhdGlvbnMvMDAzOV9wZW5hbHR5X2FjdGl2YXRpb25fdGltZS5weQ==) | `100.00% <100.00%> (ø)` | | | [lego/apps/users/notifications.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL3VzZXJzL25vdGlmaWNhdGlvbnMucHk=) | `80.95% <ø> (ø)` | | | [lego/apps/users/serializers/penalties.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL3VzZXJzL3NlcmlhbGl6ZXJzL3BlbmFsdGllcy5weQ==) | `100.00% <ø> (ø)` | | | [lego/apps/users/tests/test\_models.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL3VzZXJzL3Rlc3RzL3Rlc3RfbW9kZWxzLnB5) | `100.00% <100.00%> (ø)` | | | [lego/apps/users/tests/test\_users\_api.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL3VzZXJzL3Rlc3RzL3Rlc3RfdXNlcnNfYXBpLnB5) | `96.81% <ø> (-0.02%)` | :arrow_down: | | [lego/apps/users/models.py](https://app.codecov.io/gh/webkom/lego/pull/3349?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom#diff-bGVnby9hcHBzL3VzZXJzL21vZGVscy5weQ==) | `95.78% <94.73%> (+0.43%)` | :arrow_up: | ... and [8 files with indirect coverage changes](https://app.codecov.io/gh/webkom/lego/pull/3349/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webkom)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Arashfa0301 commented 1 year ago

Just reminder to my self: Remember to type the changes

linear[bot] commented 11 months ago
ABA-92 Implement new rules for prikk

After a meeting between all the committees responsible for events a conclusion to alter the rules for prikker was reached. This has to be implemented. The new rules are: * If you have one or more prikk you have to wait 5 hours after the ordinary registration start for an event before you can register. * The duration of a prikk is 10 days or 6 events where you have permission to register (påmeldingsrett). Each new prikk leads to an addition of the duration (i.e. 10 more days/ 6 events with a prikk) i.e. the number of prikks you have does not really matter anymore, it only matters how long you have them. pr: [https://github.com/webkom/lego/pull/3349](https://github.com/webkom/lego/pull/3349)