@@ -430,55 +430,55 @@ async def register_in_election(
430430 ))
431431 await db_session .commit ()
432432
433- @router .patch (
434- "/registration/{election_name:str}" ,
435- description = "update your speech for a specific position for an election"
436- )
437- async def update_registration (
438- request : Request ,
439- db_session : database .DBSession ,
440- election_name : str ,
441- position : str ,
442- speech : str | None ,
443- ):
444- logged_in , _ , computing_id = await is_logged_in (request , db_session )
445- if not logged_in :
446- raise HTTPException (
447- status_code = status .HTTP_401_UNAUTHORIZED ,
448- detail = "must be logged in to update election registration"
449- )
450- elif position not in OfficerPosition .position_list ():
451- raise HTTPException (
452- status_code = status .HTTP_400_BAD_REQUEST ,
453- detail = f"invalid position { position } "
454- )
455-
456- current_time = datetime .now ()
457- slugified_name = _slugify (election_name )
458- election = await elections .crud .get_election (db_session , slugified_name )
459- if election is None :
460- raise HTTPException (
461- status_code = status .HTTP_404_NOT_FOUND ,
462- detail = f"election with slug { slugified_name } does not exist"
463- )
464- elif election .status (current_time ) != elections .tables .STATUS_NOMINATIONS :
465- raise HTTPException (
466- status_code = status .HTTP_400_BAD_REQUEST ,
467- detail = "speeches can only be updated during the nomination period"
468- )
469- elif not await elections .crud .get_all_registrations (db_session , computing_id , slugified_name ):
470- raise HTTPException (
471- status_code = status .HTTP_404_NOT_FOUND ,
472- detail = "you are not yet registered in this election"
473- )
474-
475- await elections .crud .update_registration (db_session , NomineeApplication (
476- computing_id = computing_id ,
477- nominee_election = slugified_name ,
478- position = position ,
479- speech = speech
480- ))
481- await db_session .commit ()
433+ # @router.patch(
434+ # "/registration/{election_name:str}",
435+ # description="update your speech for a specific position for an election"
436+ # )
437+ # async def update_registration(
438+ # request: Request,
439+ # db_session: database.DBSession,
440+ # election_name: str,
441+ # position: str,
442+ # speech: str | None,
443+ # ):
444+ # logged_in, _, computing_id = await is_logged_in(request, db_session)
445+ # if not logged_in:
446+ # raise HTTPException(
447+ # status_code=status.HTTP_401_UNAUTHORIZED,
448+ # detail="must be logged in to update election registration"
449+ # )
450+ # elif position not in OfficerPosition.position_list():
451+ # raise HTTPException(
452+ # status_code=status.HTTP_400_BAD_REQUEST,
453+ # detail=f"invalid position {position}"
454+ # )
455+
456+ # current_time = datetime.now()
457+ # slugified_name = _slugify(election_name)
458+ # election = await elections.crud.get_election(db_session, slugified_name)
459+ # if election is None:
460+ # raise HTTPException(
461+ # status_code=status.HTTP_404_NOT_FOUND,
462+ # detail=f"election with slug {slugified_name} does not exist"
463+ # )
464+ # elif election.status(current_time) != elections.tables.STATUS_NOMINATIONS:
465+ # raise HTTPException(
466+ # status_code=status.HTTP_400_BAD_REQUEST,
467+ # detail="speeches can only be updated during the nomination period"
468+ # )
469+ # elif not await elections.crud.get_all_registrations(db_session, computing_id, slugified_name):
470+ # raise HTTPException(
471+ # status_code=status.HTTP_404_NOT_FOUND,
472+ # detail="you are not yet registered in this election"
473+ # )
474+
475+ # await elections.crud.update_registration(db_session, NomineeApplication(
476+ # computing_id=computing_id,
477+ # nominee_election=slugified_name,
478+ # position=position,
479+ # speech=speech
480+ # ))
481+ # await db_session.commit()
482482
483483@router .delete (
484484 "/registration/{election_name:str}/{position:str}" ,
@@ -616,4 +616,4 @@ async def provide_nominee_info(
616616
617617
618618 nominee_info = await elections .crud .get_nominee_info (db_session , computing_id )
619- return JSONResponse (nominee_info .as_serializable ())
619+ return JSONResponse (nominee_info .as_serializable ())
0 commit comments