Rename validation functions

This commit is contained in:
Peter Stockings
2022-11-19 16:04:04 +11:00
parent 21750f3562
commit c5029e8183
4 changed files with 11 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ def validate_person(func):
def wrapper(*args, **kwargs):
person_id = kwargs.get('person_id')
from app import db
person = db.get_person(person_id)
person = db.is_valid_person(person_id)
if person is None:
return render_template('error.html', error='404', message=f'Unable to find Person({person_id})', url='/')
return func(*args, **kwargs)
@@ -21,7 +21,7 @@ def validate_workout(func):
person_id = kwargs.get('person_id')
workout_id = kwargs.get('workout_id')
from app import db
workout = db.get_workout(person_id, workout_id)
workout = db.is_valid_workout(person_id, workout_id)
if workout is None:
return render_template('error.html', error='404', message=f'Unable to find Workout({workout_id}) completed by Person({person_id})', url=url_for('get_person', person_id=person_id))
return func(*args, **kwargs)
@@ -35,7 +35,7 @@ def validate_topset(func):
workout_id = kwargs.get('workout_id')
topset_id = kwargs.get('topset_id')
from app import db
topset = db.get_topset(person_id, workout_id, topset_id)
topset = db.is_valid_topset(person_id, workout_id, topset_id)
if topset is None:
return render_template('error.html', error='404', message=f'Unable to find TopSet({topset_id}) in Workout({workout_id}) completed by Person({person_id})', url=url_for('get_workout', person_id=person_id, workout_id=workout_id))
return func(*args, **kwargs)