Skip to content

Commit

Permalink
Paid event update (#797)
Browse files Browse the repository at this point in the history
* Feat(kontres)/add image to bookable item (#785)

* added optional image to bookable item model

* added update method in serializer to handle new images

* linting

* remove update method for images

* Feat(kontres)/add approved by (#786)

* added approved by field

* endpoint will now set approved by

* serializer will return full user object in approved_by_detail

* created test for approved by

* migration

* remove unnecessary code

* removed write-only field in approved-by context

* Create minutes for Codex (#787)

* init

* format

* Feat(minute)/viewset (#788)

* added richer reponse on post and put

* added to admin panel

* added filter for minute

* Feat(kontres)/add notification (#790)

* created methods for sending notification to admin and user

* endpoint will now send notification if needed

* add migrations for new notification types

* Memberships with fines activated (#791)

init

* Feat(user)/user bio (#758)

* Created model, serializer and view for user-bio

* Created user bio model and made migrations

* Created user bio serializer + viewsets + added new endpoint

* Tested create method + added bio serializer to user serializer

* Format

* Created update method and started testing

* Debugging test failures in user retrieve

* fixed model error

* Created user_bio_factory + started testing put method

* Created fixture for UserBio

* Created custom excpetion for duplicate user bio

* Added permissions and inherited from BaseModel

* Modularized serializer for bio

* Use correct serializers in viewset + added destroy method

* Finished testing bio viewset integration + format

* Changed environent file to .env to avoid pushing up keys

* Fix: Flipped assertion statement in test, since user bio should not be deleted

* skiped buggy test from kontres

* added mark to pytest.skip

* Moved keys to .env file and reverted docker variables

* Skip buggy kontres test

* format

* Added str method to user_bio

* Removed unused imports

* format

* Changed user relation to a OneToOne-field (same affect as ForeignKey(unique=True) + removed check for duplicate bio in serializer

* Migrations + changed assertion status code in duplicate bio test (could try catch in serializer to produce 400 status code)

* format

* format

* Changed limit for description 50 -> 500 + migrations

* Migrate

* added id to serializer

* merged leaf nodes in migrations

* format

---------

Co-authored-by: Ester2109 <126612066+Ester2109@users.noreply.github.com>
Co-authored-by: Mads Nylund <madsnyl@gmail.com>
Co-authored-by: Mads Nylund <73914541+MadsNyl@users.noreply.github.com>
Co-authored-by: Tam Le <tamle2107@hotmail.com>

* Update CHANGELOG.md

* added filter for allowed photos for user (#794)

added filter for allowed photos

* Upped payment time when coming from waiting list (#796)

---------

Co-authored-by: Erik Skjellevik <98759397+eriskjel@users.noreply.github.com>
Co-authored-by: haruixu <114171733+haruixu@users.noreply.github.com>
Co-authored-by: Ester2109 <126612066+Ester2109@users.noreply.github.com>
Co-authored-by: Tam Le <tamle2107@hotmail.com>
  • Loading branch information
5 people committed Apr 17, 2024
1 parent e3e6b39 commit 1be35c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/content/models/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def delete(self, *args, **kwargs):
if moved_registration.event.is_paid_event:
try:
start_payment_countdown(
moved_registration.event, moved_registration
moved_registration.event,
moved_registration,
from_wait_list=True,
)
except Exception as countdown_error:
capture_exception(countdown_error)
Expand Down
11 changes: 8 additions & 3 deletions app/content/util/event_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)


def start_payment_countdown(event, registration):
def start_payment_countdown(event, registration, from_wait_list=False):
"""
Checks if event is a paid event
and starts the countdown for payment for an user.
Expand All @@ -24,13 +24,18 @@ def start_payment_countdown(event, registration):
try:
check_if_has_paid.apply_async(
args=(event.id, registration.registration_id),
countdown=get_countdown_time(event),
countdown=get_countdown_time(event, from_wait_list),
)
except Exception as payment_countdown_error:
capture_exception(payment_countdown_error)


def get_countdown_time(event):
def get_countdown_time(event, from_wait_list=False):
if from_wait_list:
# 12 hours and 10 minutes as seconds
return (12 * 60 * 60) + (10 * 60)

# paytime as seconds
paytime = event.paid_information.paytime
return (paytime.hour * 60 + paytime.minute + 10) * 60 + paytime.second

Expand Down

0 comments on commit 1be35c9

Please sign in to comment.