Refactoring routine_detail function (end). Close #20
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
b39d33caf5
commit
d6776768ab
|
@ -235,12 +235,14 @@ class Routine(Educative):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def max_even_if_none(value_1, value_2):
|
def max_even_if_none(value_1, value_2):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
if value_1 is not None and value_2 is not None:
|
if value_1 is not None and value_2 is not None:
|
||||||
if value_1 > value_2:
|
if value_1 > value_2:
|
||||||
return value_1
|
return value_1
|
||||||
else:
|
else:
|
||||||
return value_2
|
return value_2
|
||||||
return None
|
return 0
|
||||||
|
|
||||||
def compute_informations(self):
|
def compute_informations(self):
|
||||||
"""
|
"""
|
||||||
|
@ -269,22 +271,22 @@ class Routine(Educative):
|
||||||
is_competitive = False
|
is_competitive = False
|
||||||
|
|
||||||
# Age boy computing
|
# Age boy computing
|
||||||
age_boy_with_help = max_even_if_none(skill.age_boy_with_help, age_boy_with_help)
|
age_boy_with_help = self.max_even_if_none(skill.age_boy_with_help, age_boy_with_help)
|
||||||
age_boy_without_help = max_even_if_none(
|
age_boy_without_help = self.max_even_if_none(
|
||||||
skill.age_boy_without_help,
|
skill.age_boy_without_help,
|
||||||
age_boy_without_help
|
age_boy_without_help
|
||||||
)
|
)
|
||||||
age_boy_chained = max_even_if_none(skill.age_boy_chained, age_boy_chained)
|
age_boy_chained = self.max_even_if_none(skill.age_boy_chained, age_boy_chained)
|
||||||
age_boy_masterised = max_even_if_none(skill.age_boy_masterised, age_boy_masterised)
|
age_boy_masterised = self.max_even_if_none(skill.age_boy_masterised, age_boy_masterised)
|
||||||
|
|
||||||
# Age girl computing
|
# Age girl computing
|
||||||
age_girl_with_help = max_even_if_none(skill.age_girl_with_help, age_girl_with_help)
|
age_girl_with_help = self.max_even_if_none(skill.age_girl_with_help, age_girl_with_help)
|
||||||
age_girl_without_help = max_even_if_none(
|
age_girl_without_help = self.max_even_if_none(
|
||||||
skill.age_girl_without_help,
|
skill.age_girl_without_help,
|
||||||
age_girl_without_help
|
age_girl_without_help
|
||||||
)
|
)
|
||||||
age_girl_chained = max_even_if_none(skill.age_girl_chained, age_girl_chained)
|
age_girl_chained = self.max_even_if_none(skill.age_girl_chained, age_girl_chained)
|
||||||
age_girl_masterised = max_even_if_none(skill.age_girl_masterised, age_girl_masterised)
|
age_girl_masterised = self.max_even_if_none(skill.age_girl_masterised, age_girl_masterised)
|
||||||
|
|
||||||
|
|
||||||
if self.skill_links.all().count() != 10:
|
if self.skill_links.all().count() != 10:
|
||||||
|
|
Loading…
Reference in New Issue