Routine details bug fix.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Gregory Trullemans 2022-01-08 11:53:19 +01:00
parent 77779843e6
commit edfb858aa9
1 changed files with 46 additions and 13 deletions

View File

@ -174,8 +174,14 @@ def routine_details(request, routineid):
rank = 0 rank = 0
level = 0 level = 0
age_boy = 0 age_boy_with_help = 0
age_girl = 0 age_girl_with_help = 0
age_boy_without_help = 0
age_girl_without_help = 0
age_boy_chained = 0
age_girl_chained = 0
age_boy_masterised = 0
age_girl_masterised = 0
difficulty = 0 difficulty = 0
is_competitive = True is_competitive = True
@ -188,14 +194,31 @@ def routine_details(request, routineid):
if not skill_link.skill.is_competitive: if not skill_link.skill.is_competitive:
is_competitive = False is_competitive = False
if skill_link.skill.age_boy is not None and skill_link.skill.age_boy > age_boy: # Age boy computing
age_boy = skill_link.skill.age_boy if skill_link.skill.age_boy_with_help is not None and skill_link.skill.age_boy_with_help > age_boy_with_help:
age_boy_with_help = skill_link.skill.age_boy_with_help
if ( if skill_link.skill.age_boy_without_help is not None and skill_link.skill.age_boy_without_help > age_boy_without_help:
skill_link.skill.age_girl is not None age_boy_without_help = skill_link.skill.age_boy_without_help
and skill_link.skill.age_girl > age_girl
): if skill_link.skill.age_boy_chained is not None and skill_link.skill.age_boy_chained > age_boy_chained:
age_girl = skill_link.skill.age_girl age_boy_chained = skill_link.skill.age_boy_chained
if skill_link.skill.age_boy_masterised is not None and skill_link.skill.age_boy_masterised > age_boy_masterised:
age_boy_masterised = skill_link.skill.age_boy_masterised
# Age girl computing
if skill_link.skill.age_girl_with_help is not None and skill_link.skill.age_girl_with_help > age_girl_with_help:
age_girl_with_help = skill_link.skill.age_girl_with_help
if skill_link.skill.age_girl_without_help is not None and skill_link.skill.age_girl_without_help > age_girl_without_help:
age_girl_without_help = skill_link.skill.age_girl_without_help
if skill_link.skill.age_girl_chained is not None and skill_link.skill.age_girl_chained > age_girl_chained:
age_girl_chained = skill_link.skill.age_girl_chained
if skill_link.skill.age_girl_masterised is not None and skill_link.skill.age_girl_masterised > age_girl_masterised:
age_girl_masterised = skill_link.skill.age_girl_masterised
if routine.skill_links.all().count() != 10: if routine.skill_links.all().count() != 10:
is_competitive = False is_competitive = False
@ -204,11 +227,21 @@ def routine_details(request, routineid):
routine.level = max(routine.level, level) routine.level = max(routine.level, level)
routine.rank = max(routine.rank, rank) routine.rank = max(routine.rank, rank)
if routine.age_boy is None or routine.age_boy < age_boy: routine.age_boy_with_help = max(routine.age_boy_with_help, age_boy_with_help)
routine.age_boy = age_boy routine.age_boy_without_help = max(
routine.age_boy_without_help,
age_boy_without_help
)
routine.age_boy_chained = max(routine.age_boy_chained, age_boy_chained)
routine.age_boy_masterised = max(routine.age_boy_masterised, age_boy_masterised)
if routine.age_girl is None or routine.age_girl < age_girl: routine.age_girl_with_help = max(routine.age_girl_with_help, age_girl_with_help)
routine.age_girl = age_girl routine.age_girl_without_help = max(
routine.age_girl_without_help,
age_girl_without_help
)
routine.age_girl_chained = max(routine.age_girl_chained, age_girl_chained)
routine.age_girl_masterised = max(routine.age_girl_masterised, age_girl_masterised)
routine.is_competitive = is_competitive routine.is_competitive = is_competitive