Skip to content

Commit 335cb22

Browse files
committed
minor word corrections
1 parent 702025b commit 335cb22

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

src/alembic/versions/243190df5588_create_election_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def upgrade() -> None:
2828
sa.Column("datetime_start_nominations", sa.DateTime(), nullable=False),
2929
sa.Column("datetime_start_voting", sa.DateTime(), nullable=False),
3030
sa.Column("datetime_end_voting", sa.DateTime(), nullable=False),
31-
sa.Column("avaliable_positions", sa.Text(), nullable=False),
31+
sa.Column("available_positions", sa.Text(), nullable=False),
3232
sa.Column("survey_link", sa.String(length=300), nullable=True),
3333
sa.PrimaryKeyConstraint("slug")
3434
)

src/elections/tables.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Election(Base):
4545
datetime_end_voting = Column(DateTime, nullable=False)
4646

4747
# a csv list of positions which must be elements of OfficerPosition
48-
avaliable_positions = Column(Text, nullable=False)
48+
available_positions = Column(Text, nullable=False)
4949
survey_link = Column(String(300))
5050

5151
def private_details(self, at_time: datetime) -> dict:
@@ -60,7 +60,7 @@ def private_details(self, at_time: datetime) -> dict:
6060
"datetime_end_voting": self.datetime_end_voting.isoformat(),
6161

6262
"status": self.status(at_time),
63-
"avaliable_positions": self.avaliable_positions,
63+
"available_positions": self.available_positions,
6464
"survey_link": self.survey_link,
6565
}
6666

@@ -76,7 +76,7 @@ def public_details(self, at_time: datetime) -> dict:
7676
"datetime_end_voting": self.datetime_end_voting.isoformat(),
7777

7878
"status": self.status(at_time),
79-
"avaliable_positions": self.avaliable_positions,
79+
"available_positions": self.available_positions,
8080
}
8181

8282
def public_metadata(self, at_time: datetime) -> dict:
@@ -103,7 +103,7 @@ def to_update_dict(self) -> dict:
103103
"datetime_start_voting": self.datetime_start_voting,
104104
"datetime_end_voting": self.datetime_end_voting,
105105

106-
"avaliable_positions": self.avaliable_positions,
106+
"available_positions": self.available_positions,
107107
"survey_link": self.survey_link,
108108
}
109109

src/elections/urls.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def get_election(
9393
all_nominations = await elections.crud.get_all_registrations_in_election(db_session, slugified_name)
9494
election_json["candidates"] = []
9595

96-
avaliable_positions_list = election.avaliable_positions.split(",")
96+
avaliable_positions_list = election.available_positions.split(",")
9797
for nomination in all_nominations:
9898
if nomination.position not in avaliable_positions_list:
9999
# ignore any positions that are **no longer** active
@@ -134,7 +134,7 @@ def _raise_if_bad_election_data(
134134
datetime_start_nominations: datetime,
135135
datetime_start_voting: datetime,
136136
datetime_end_voting: datetime,
137-
avaliable_positions: str | None,
137+
available_positions: str | None,
138138
):
139139
if election_type not in election_types:
140140
raise HTTPException(
@@ -149,8 +149,8 @@ def _raise_if_bad_election_data(
149149
status_code=status.HTTP_400_BAD_REQUEST,
150150
detail="dates must be in order from earliest to latest",
151151
)
152-
elif avaliable_positions is not None:
153-
for position in avaliable_positions.split(","):
152+
elif available_positions is not None:
153+
for position in available_positions.split(","):
154154
if position not in OfficerPosition.position_list():
155155
raise HTTPException(
156156
status_code=status.HTTP_400_BAD_REQUEST,
@@ -175,7 +175,7 @@ async def create_election(
175175
datetime_start_voting: datetime,
176176
datetime_end_voting: datetime,
177177
# allows None, which assigns it to the default
178-
avaliable_positions: str | None = None,
178+
available_positions: str | None = None,
179179
survey_link: str | None = None,
180180
):
181181
# ensure that election name is not "list" as it will collide with endpoint
@@ -185,13 +185,13 @@ async def create_election(
185185
detail="cannot use that election name",
186186
)
187187

188-
if avaliable_positions is None:
188+
if available_positions is None:
189189
if election_type == "general_election":
190-
avaliable_positions = elections.tables.DEFAULT_POSITIONS_GENERAL_ELECTION
190+
available_positions = elections.tables.DEFAULT_POSITIONS_GENERAL_ELECTION
191191
elif election_type == "by_election":
192-
avaliable_positions = elections.tables.DEFAULT_POSITIONS_BY_ELECTION
192+
available_positions = elections.tables.DEFAULT_POSITIONS_BY_ELECTION
193193
elif election_type == "council_rep_election":
194-
avaliable_positions = elections.tables.DEFAULT_POSITIONS_COUNCIL_REP_ELECTION
194+
available_positions = elections.tables.DEFAULT_POSITIONS_COUNCIL_REP_ELECTION
195195
else:
196196
raise HTTPException(
197197
status_code=status.HTTP_400_BAD_REQUEST,
@@ -205,7 +205,7 @@ async def create_election(
205205
datetime_start_nominations,
206206
datetime_start_voting,
207207
datetime_end_voting,
208-
avaliable_positions,
208+
available_positions,
209209
)
210210

211211
is_valid_user, _, _ = await _validate_user(request, db_session)
@@ -232,7 +232,7 @@ async def create_election(
232232
datetime_start_nominations = datetime_start_nominations,
233233
datetime_start_voting = datetime_start_voting,
234234
datetime_end_voting = datetime_end_voting,
235-
avaliable_positions = avaliable_positions,
235+
available_positions = available_positions,
236236
survey_link = survey_link
237237
)
238238
)
@@ -260,7 +260,7 @@ async def update_election(
260260
datetime_start_nominations: datetime,
261261
datetime_start_voting: datetime,
262262
datetime_end_voting: datetime,
263-
avaliable_positions: str,
263+
available_positions: str,
264264
survey_link: str | None = None,
265265
):
266266
slugified_name = _slugify(election_name)
@@ -271,7 +271,7 @@ async def update_election(
271271
datetime_start_nominations,
272272
datetime_start_voting,
273273
datetime_end_voting,
274-
avaliable_positions,
274+
available_positions,
275275
)
276276

277277
is_valid_user, _, _ = await _validate_user(request, db_session)
@@ -298,7 +298,7 @@ async def update_election(
298298
datetime_start_nominations = datetime_start_nominations,
299299
datetime_start_voting = datetime_start_voting,
300300
datetime_end_voting = datetime_end_voting,
301-
avaliable_positions = avaliable_positions,
301+
available_positions = available_positions,
302302
survey_link = survey_link
303303
)
304304
)
@@ -401,7 +401,7 @@ async def register_in_election(
401401
status_code=status.HTTP_404_NOT_FOUND,
402402
detail=f"election with slug {slugified_name} does not exist"
403403
)
404-
elif position not in election.avaliable_positions.split(","):
404+
elif position not in election.available_positions.split(","):
405405
# NOTE: We only restrict creating a registration for a position that doesn't exist,
406406
# not updating or deleting one
407407
raise HTTPException(

src/load_test_db.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ async def load_test_elections_data(db_session: AsyncSession):
303303
datetime_start_nominations=datetime.now() - timedelta(days=400),
304304
datetime_start_voting=datetime.now() - timedelta(days=395, hours=4),
305305
datetime_end_voting=datetime.now() - timedelta(days=390, hours=8),
306-
avaliable_positions="president,vice-president",
306+
available_positions="president,vice-president",
307307
survey_link="https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5"
308308
))
309309
await update_election(db_session, Election(
@@ -313,7 +313,7 @@ async def load_test_elections_data(db_session: AsyncSession):
313313
datetime_start_nominations=datetime.now() - timedelta(days=400),
314314
datetime_start_voting=datetime.now() - timedelta(days=395, hours=4),
315315
datetime_end_voting=datetime.now() - timedelta(days=390, hours=8),
316-
avaliable_positions="president,vice-president,treasurer",
316+
available_positions="president,vice-president,treasurer",
317317
survey_link="https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5"
318318
))
319319
await create_election(db_session, Election(
@@ -323,7 +323,7 @@ async def load_test_elections_data(db_session: AsyncSession):
323323
datetime_start_nominations=datetime.now() - timedelta(days=1),
324324
datetime_start_voting=datetime.now() + timedelta(days=7),
325325
datetime_end_voting=datetime.now() + timedelta(days=14),
326-
avaliable_positions="president,vice-president,treasurer",
326+
available_positions="president,vice-president,treasurer",
327327
survey_link="https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5 (oh yeah)"
328328
))
329329
await create_nominee_info(db_session, NomineeInfo(
@@ -349,7 +349,7 @@ async def load_test_elections_data(db_session: AsyncSession):
349349
datetime_start_nominations=datetime.now() - timedelta(days=5),
350350
datetime_start_voting=datetime.now() - timedelta(days=1, hours=4),
351351
datetime_end_voting=datetime.now() + timedelta(days=5, hours=8),
352-
avaliable_positions="president,vice-president,treasurer",
352+
available_positions="president,vice-president,treasurer",
353353
survey_link="https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5"
354354
))
355355
await create_election(db_session, Election(
@@ -359,7 +359,7 @@ async def load_test_elections_data(db_session: AsyncSession):
359359
datetime_start_nominations=datetime.now() + timedelta(days=5),
360360
datetime_start_voting=datetime.now() + timedelta(days=10, hours=4),
361361
datetime_end_voting=datetime.now() + timedelta(days=15, hours=8),
362-
avaliable_positions="president,vice-president,treasurer",
362+
available_positions="president,vice-president,treasurer",
363363
survey_link=None
364364
))
365365
await db_session.commit()

tests/integration/test_elections.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def test_endpoints(client, database_setup):
125125
"datetime_start_nominations": "2025-08-18T09:00:00Z",
126126
"datetime_start_voting": "2025-09-03T09:00:00Z",
127127
"datetime_end_voting": "2025-09-18T23:59:59Z",
128-
"avaliable_positions": "president",
128+
"available_positions": "president",
129129
"survey_link": "https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5"
130130

131131
})
@@ -143,7 +143,7 @@ async def test_endpoints(client, database_setup):
143143
"datetime_start_nominations": "2025-08-18T09:00:00Z",
144144
"datetime_start_voting": "2025-09-03T09:00:00Z",
145145
"datetime_end_voting": "2025-09-18T23:59:59Z",
146-
"avaliable_positions": "president,treasurer",
146+
"available_positions": "president,treasurer",
147147
"survey_link": "https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5"
148148

149149
})
@@ -206,7 +206,7 @@ async def test_endpoints_admin(client, database_setup):
206206
"datetime_start_nominations": (datetime.now() - timedelta(days=1)).isoformat(),
207207
"datetime_start_voting": (datetime.now() + timedelta(days=7)).isoformat(),
208208
"datetime_end_voting": (datetime.now() + timedelta(days=14)).isoformat(),
209-
"avaliable_positions": "president,treasurer",
209+
"available_positions": "president,treasurer",
210210
"survey_link": "https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5"
211211
})
212212
assert response.status_code == 200
@@ -280,7 +280,7 @@ async def test_endpoints_admin(client, database_setup):
280280
"datetime_start_nominations": (datetime.now() - timedelta(days=1)).isoformat(),
281281
"datetime_start_voting": (datetime.now() + timedelta(days=7)).isoformat(),
282282
"datetime_end_voting": (datetime.now() + timedelta(days=14)).isoformat(),
283-
"avaliable_positions": "president,vice-president,treasurer", # update this
283+
"available_positions": "president,vice-president,treasurer", # update this
284284
"survey_link": "https://youtu.be/dQw4w9WgXcQ?si=kZROi2tu-43MXPM5"
285285
})
286286
assert response.status_code == 200

0 commit comments

Comments
 (0)