4
4
5
5
_logger = logging .getLogger (__name__ )
6
6
7
- # TODO: remove enum, b/d python enums suck
8
- class OfficerPosition (Enum ):
9
- President = "president"
10
- VicePresident = "vice-president"
11
- Treasurer = "treasurer"
12
-
13
- DirectorOfResources = "director of resources"
14
- DirectorOfEvents = "director of events"
15
- DirectorOfEducationalEvents = "director of educational events"
16
- AssistantDirectorOfEvents = "assistant director of events"
17
- DirectorOfCommunications = "director of communications"
18
- #DirectorOfOutreach = "director of outreach"
19
- DirectorOfMultimedia = "director of multimedia"
20
- DirectorOfArchives = "director of archives"
21
- ExecutiveAtLarge = "executive at large"
22
- FirstYearRepresentative = "first year representative"
23
-
24
- ElectionsOfficer = "elections officer"
25
- SFSSCouncilRepresentative = "sfss council representative"
26
- FroshWeekChair = "frosh week chair"
27
-
28
- SystemAdministrator = "system administrator"
29
- Webmaster = "webmaster"
30
- SocialMediaManager = "social media manager"
7
+ class OfficerPosition :
8
+ PRESIDENT = "president"
9
+ VICE_PRESIDENT = "vice-president"
10
+ TREASURER = "treasurer"
11
+
12
+ DIRECTOR_OF_RESOURCES = "director of resources"
13
+ DIRECTOR_OF_EVENTS = "director of events"
14
+ DIRECTOR_OF_EDUCATIONAL_EVENTS = "director of educational events"
15
+ ASSISTANT_DIRECTOR_OF_EVENTS = "assistant director of events"
16
+ DIRECTOR_OF_COMMUNICATIONS = "director of communications"
17
+ #DIRECTOR_OF_OUTREACH = "director of outreach"
18
+ DIRECTOR_OF_MULTIMEDIA = "director of multimedia"
19
+ DIRECTOR_OF_ARCHIVES = "director of archives"
20
+ EXECUTIVE_AT_LARGE = "executive at large"
21
+ FIRST_YEAR_REPRESENTATIVE = "first year representative"
22
+
23
+ ELECTIONS_OFFICER = "elections officer"
24
+ SFSS_COUNCIL_REPRESENTATIVE = "sfss council representative"
25
+ FROSH_WEEK_CHAIR = "frosh week chair"
26
+
27
+ SYSTEM_ADMINISTRATOR = "system administrator"
28
+ WEBMASTER = "webmaster"
29
+ SOCIAL_MEDIA_MANAGER = "social media manager"
31
30
32
31
@staticmethod
33
- def position_values () -> list [str ]:
34
- return _OFFICER_POSITION_VALUES
32
+ def position_list () -> list [str ]:
33
+ return _OFFICER_POSITION_LIST
35
34
36
35
@staticmethod
37
- def from_string (position : str ) -> Self | None :
38
- for item in OfficerPosition :
39
- if position == item .value :
40
- return item
41
-
42
- _logger .warning (f"Unknown OfficerPosition position = { position } . reporting N/A." )
43
- return None
44
-
45
- def to_string (self ) -> str :
46
- return self .value
47
-
48
- def to_email (self ) -> str :
49
- match self :
50
- case OfficerPosition .President :
51
-
52
- case OfficerPosition .VicePresident :
53
-
54
- case OfficerPosition .Treasurer :
55
-
56
-
57
- case OfficerPosition .DirectorOfResources :
58
-
59
- case OfficerPosition .DirectorOfEvents :
60
-
61
- case OfficerPosition .DirectorOfEducationalEvents :
62
-
63
- case OfficerPosition .AssistantDirectorOfEvents :
64
-
65
- case OfficerPosition .DirectorOfCommunications :
66
-
67
- case OfficerPosition .DirectorOfMultimedia :
68
-
69
- case OfficerPosition .DirectorOfArchives :
70
-
71
- case OfficerPosition .ExecutiveAtLarge :
72
-
73
- case OfficerPosition .FirstYearRepresentative :
74
-
75
-
76
- case OfficerPosition .ElectionsOfficer :
77
-
78
- case OfficerPosition .SFSSCouncilRepresentative :
79
-
80
- case OfficerPosition .FroshWeekChair :
81
-
82
-
83
- case OfficerPosition .SystemAdministrator :
84
-
85
- case OfficerPosition .Webmaster :
86
-
87
- case OfficerPosition .SocialMediaManager :
88
- return "N/A"
89
-
90
- def num_active (self ) -> int | None :
36
+ def to_email (position : str ) -> str | None :
37
+ return _EMAIL_MAP .get (position , None )
38
+
39
+ @staticmethod
40
+ def num_active (position : str ) -> int | None :
91
41
"""
92
42
The number of executive positions active at a given time
93
43
"""
94
44
# None means there can be any number active
95
45
if (
96
- self == OfficerPosition .ExecutiveAtLarge
97
- or self == OfficerPosition .FirstYearRepresentative
46
+ position == OfficerPosition .ExecutiveAtLarge
47
+ or position == OfficerPosition .FirstYearRepresentative
98
48
):
99
49
return 2
100
50
elif (
101
- self == OfficerPosition .FroshWeekChair
102
- or self == OfficerPosition .SocialMediaManager
51
+ position == OfficerPosition .FroshWeekChair
52
+ or position == OfficerPosition .SocialMediaManager
103
53
):
104
- # TODO: configure this value in a database table somewhere?
105
54
return None
106
55
else :
107
56
return 1
108
57
109
- def is_signer (self ) -> bool :
58
+ @staticmethod
59
+ def is_signer (position : str ) -> bool :
110
60
"""
111
61
If the officer is a signing authority of the CSSS
112
62
"""
113
63
return (
114
- self == OfficerPosition .President
115
- or self == OfficerPosition .VicePresident
116
- or self == OfficerPosition .Treasurer
117
- or self == OfficerPosition .DirectorOfResources
118
- or self == OfficerPosition .DirectorOfEvents
64
+ position == OfficerPosition .President
65
+ or position == OfficerPosition .VicePresident
66
+ or position == OfficerPosition .Treasurer
67
+ or position == OfficerPosition .DirectorOfResources
68
+ or position == OfficerPosition .DirectorOfEvents
119
69
)
120
70
121
71
@staticmethod
122
- def expected_positions () -> list [Self ]:
72
+ def expected_positions () -> list [str ]:
123
73
return [
124
74
OfficerPosition .President ,
125
75
OfficerPosition .VicePresident ,
@@ -145,6 +95,52 @@ def expected_positions() -> list[Self]:
145
95
OfficerPosition .Webmaster ,
146
96
]
147
97
148
- _OFFICER_POSITION_VALUES = [
149
- pos .value for pos in OfficerPosition .__members__ .values ()
98
+ _EMAIL_MAP = {
99
+ OfficerPosition .
PRESIDENT :
"[email protected] " ,
100
+ OfficerPosition .
VICE_PRESIDENT :
"[email protected] " ,
101
+ OfficerPosition .
TREASURER :
"[email protected] " ,
102
+
103
+ OfficerPosition .
DIRECTOR_OF_RESOURCES :
"[email protected] " ,
104
+ OfficerPosition .
DIRECTOR_OF_EVENTS :
"[email protected] " ,
105
+ OfficerPosition .
DIRECTOR_OF_EDUCATIONAL_EVENTS :
"[email protected] " ,
106
+ OfficerPosition .
ASSISTANT_DIRECTOR_OF_EVENTS :
"[email protected] " ,
107
+ OfficerPosition .
DIRECTOR_OF_COMMUNICATIONS :
"[email protected] " ,
108
+ #OfficerPosition.DIRECTOR_OF_OUTREACH,
109
+ OfficerPosition .
DIRECTOR_OF_MULTIMEDIA :
"[email protected] " ,
110
+ OfficerPosition .
DIRECTOR_OF_ARCHIVES :
"[email protected] " ,
111
+ OfficerPosition .
EXECUTIVE_AT_LARGE :
"[email protected] " ,
112
+ OfficerPosition .
FIRST_YEAR_REPRESENTATIVE :
"[email protected] " ,
113
+
114
+ OfficerPosition .
ELECTIONS_OFFICER :
"[email protected] " ,
115
+ OfficerPosition .
SFSS_COUNCIL_REPRESENTATIVE :
"[email protected] " ,
116
+ OfficerPosition .
FROSH_WEEK_CHAIR :
"[email protected] " ,
117
+
118
+ OfficerPosition .
SYSTEM_ADMINISTRATOR :
"[email protected] " ,
119
+ OfficerPosition .
WEBMASTER :
"[email protected] " ,
120
+ OfficerPosition .SOCIAL_MEDIA_MANAGER : "N/A" ,
121
+ }
122
+
123
+ _OFFICER_POSITION_LIST = [
124
+ OfficerPosition .PRESIDENT ,
125
+ OfficerPosition .VICE_PRESIDENT ,
126
+ OfficerPosition .TREASURER ,
127
+
128
+ OfficerPosition .DIRECTOR_OF_RESOURCES ,
129
+ OfficerPosition .DIRECTOR_OF_EVENTS ,
130
+ OfficerPosition .DIRECTOR_OF_EDUCATIONAL_EVENTS ,
131
+ OfficerPosition .ASSISTANT_DIRECTOR_OF_EVENTS ,
132
+ OfficerPosition .DIRECTOR_OF_COMMUNICATIONS ,
133
+ #OfficerPosition.DIRECTOR_OF_OUTREACH,
134
+ OfficerPosition .DIRECTOR_OF_MULTIMEDIA ,
135
+ OfficerPosition .DIRECTOR_OF_ARCHIVES ,
136
+ OfficerPosition .EXECUTIVE_AT_LARGE ,
137
+ OfficerPosition .FIRST_YEAR_REPRESENTATIVE ,
138
+
139
+ OfficerPosition .ELECTIONS_OFFICER ,
140
+ OfficerPosition .SFSS_COUNCIL_REPRESENTATIVE ,
141
+ OfficerPosition .FROSH_WEEK_CHAIR ,
142
+
143
+ OfficerPosition .SYSTEM_ADMINISTRATOR ,
144
+ OfficerPosition .WEBMASTER ,
145
+ OfficerPosition .SOCIAL_MEDIA_MANAGER ,
150
146
]
0 commit comments