Compare commits

...

2 Commits

Author SHA1 Message Date
Gregory Trullemans b84017614f update comments 2022-10-31 12:15:49 +01:00
Gregory Trullemans b4f71b86f0 Update way to compute rank 2022-10-31 12:14:05 +01:00
2 changed files with 31 additions and 13 deletions

View File

@ -30,27 +30,44 @@ class Command(BaseCommand):
age_girl_chained = 0
age_girl_masterised = 0
print(str(count) + ' - Traitement de ' + str(educative.long_label))
breadcrumb = educative.breadcrumb()
print(str(count) + " - Traitement de " + str(educative.long_label))
breadcrumb = educative.breadcrumb()
for path in range(0, len(breadcrumb)):
tree = set(PrerequisiteClosure.objects.filter(descendant=educative, path=path))
tree = set(
PrerequisiteClosure.objects.filter(descendant=educative, path=path)
)
for position, ancestor in enumerate(breadcrumb[path]):
tree_path, _ = PrerequisiteClosure.objects.get_or_create(
ancestor=ancestor, descendant=educative, level=position, path=path
ancestor=ancestor,
descendant=educative,
level=position,
path=path,
)
max_level = max(max_level, position)
max_rank = max(max_rank, ancestor.rank + 1)
age_boy_with_help = max(age_boy_with_help, ancestor.age_boy_with_help)
age_boy_without_help = max(age_boy_without_help, ancestor.age_boy_without_help)
max_rank = max(max_rank, max_level, ancestor.rank + 1)
age_boy_with_help = max(
age_boy_with_help, ancestor.age_boy_with_help
)
age_boy_without_help = max(
age_boy_without_help, ancestor.age_boy_without_help
)
age_boy_chained = max(age_boy_chained, ancestor.age_boy_chained)
age_boy_masterised = max(age_boy_masterised, ancestor.age_boy_masterised)
age_boy_masterised = max(
age_boy_masterised, ancestor.age_boy_masterised
)
age_girl_with_help = max(age_girl_with_help, ancestor.age_girl_with_help)
age_girl_without_help = max(age_girl_without_help, ancestor.age_girl_without_help)
age_girl_with_help = max(
age_girl_with_help, ancestor.age_girl_with_help
)
age_girl_without_help = max(
age_girl_without_help, ancestor.age_girl_without_help
)
age_girl_chained = max(age_girl_chained, ancestor.age_girl_chained)
age_girl_masterised = max(age_girl_masterised, ancestor.age_girl_masterised)
age_girl_masterised = max(
age_girl_masterised, ancestor.age_girl_masterised
)
if tree_path in tree:
tree.remove(tree_path)

View File

@ -18,8 +18,9 @@ class Educative(Markdownizable):
Rank : Le rang permet, en plus du `level` (niveau), de classer les figures entre elles, de leur
donner un ordre (informatif). Le rang dune figure est calculé par rapport aux prérequis : par
défaut le rang dune figure est égal au niveau maximum de ses prérequis plus un.
donner un ordre (informatif). Le rang dune figure est calculé par rapport aux prérequis et au
niveau : par défaut le rang dune figure est le maximum entre le niveau maximum de ses
prérequis plus un et le niveau de la figure.
Le rang, avec le niveau, ont pour but daider les coaches à planifier lévolution et
lapprentissage des figures les unes par rapport aux autres.