Skip to content

Commit 6a7efba

Browse files
Fix fid deletion
fid attendances were not being counted
1 parent 246c24e commit 6a7efba

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

conditional/blueprints/member_management.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,23 +362,32 @@ def get_hm_date(hm_id):
362362
}), 200
363363

364364

365-
@member_management_bp.route('/manage/user/<uid>', methods=['DELETE'])
366-
def member_management_deleteuser(uid):
365+
@member_management_bp.route('/manage/user/<fid>', methods=['DELETE'])
366+
def member_management_deleteuser(fid):
367367
log = logger.new(user_name=request.headers.get("x-webauth-user"),
368368
request_id=str(uuid.uuid4()))
369-
log.info('api', action='edit uid user')
369+
log.info('api', action='edit fid user')
370370

371371
user_name = request.headers.get('x-webauth-user')
372372

373373
if not ldap_is_eval_director(user_name):
374374
return "must be eval director", 403
375375

376-
if not uid.isdigit():
376+
if not fid.isdigit():
377377
return "can only delete freshman accounts", 400
378378

379-
logger.info('backend', action="delete freshman account %s" % (uid))
379+
logger.info('backend', action="delete freshman account %s" % (fid))
380+
381+
for fca in FreshmanCommitteeAttendance.query.filter(FreshmanCommitteeAttendance.fid == fid):
382+
db.session.delete(fca)
383+
384+
for fts in FreshmanSeminarAttendance.query.filter(FreshmanSeminarAttendance.fid == fid):
385+
db.session.delete(fts)
386+
387+
for fhm in FreshmanHouseMeetingAttendance.query.filter(FreshmanHouseMeetingAttendance.fid == fid):
388+
db.session.delete(fhm)
380389

381-
FreshmanAccount.query.filter(FreshmanAccount.id == uid).delete()
390+
FreshmanAccount.query.filter(FreshmanAccount.id == fid).delete()
382391

383392
db.session.flush()
384393
db.session.commit()

0 commit comments

Comments
 (0)