Coverage for website/events/models/status.py: 78.79%

27 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2025-08-14 10:31 +0000

1# Not registered, cannot register yet 

2STATUS_WILL_OPEN = "registration-will-open" 

3 

4# Not registered, deadline expired 

5STATUS_EXPIRED = "registration-expired" 

6 

7# Not registered, can register 

8STATUS_OPEN = "registration-open" 

9 

10# Not registered, can put self on waiting list 

11STATUS_FULL = "registration-full" 

12 

13# Registered, on waiting list 

14STATUS_WAITINGLIST = "registration-waitinglist" 

15 

16# Registered 

17# No cancel means cancellation deadline expired; user cannot deregister without paying a fine 

18# No rereg means registration deadline expired; user cannot re-register if they deregister 

19STATUS_REGISTERED = "registration-registered" 

20 

21# User cancelled their registration; if LATE they missed the deadline and need to pay the fine 

22STATUS_CANCELLED = "registration-cancelled" 

23STATUS_CANCELLED_FINAL = "registration-cancelled-final" 

24STATUS_CANCELLED_LATE = "registration-cancelled-late" 

25 

26# Registering is optional; no or yes registration 

27STATUS_OPTIONAL = "registration-optional" 

28STATUS_OPTIONAL_REGISTERED = "registration-optional-registered" 

29 

30# Registrations are disabled 

31STATUS_NONE = "registration-none" 

32 

33# User is not logged in so cannot register 

34STATUS_LOGIN = "registration-login" 

35 

36CANCEL_NORMAL = "cancel-normal" # Cancellation allowed 

37CANCEL_FINAL = "cancel-final" # Can cancel, but will not be able to re-register 

38CANCEL_LATE = "cancel-late" # Too late, will pay fine 

39CANCEL_WAITINGLIST = ( 

40 "cancel-waitinglist" # Too late, but allowed because user is on waitinglist 

41) 

42 

43 

44def is_registered(status): 

45 return status in [STATUS_REGISTERED, STATUS_OPTIONAL_REGISTERED, STATUS_WAITINGLIST] 

46 

47 

48def calendarjs_class_name(status): 

49 if status == STATUS_WAITINGLIST: 49 ↛ 50line 49 didn't jump to line 50 because the condition on line 49 was never true

50 return "regular-event-pending-registration" 

51 if status in [STATUS_OPTIONAL_REGISTERED, STATUS_REGISTERED]: 51 ↛ 52line 51 didn't jump to line 52 because the condition on line 51 was never true

52 return "regular-event-has-registration" 

53 if status in [ 53 ↛ 61line 53 didn't jump to line 61 because the condition on line 53 was always true

54 STATUS_CANCELLED, 

55 STATUS_OPEN, 

56 STATUS_FULL, 

57 STATUS_OPTIONAL, 

58 STATUS_NONE, 

59 ]: 

60 return "regular-event-registration-open" 

61 return "regular-event-registration-closed"