diff --git a/src/objective/views.py b/src/objective/views.py index 0402367..567b671 100644 --- a/src/objective/views.py +++ b/src/objective/views.py @@ -337,7 +337,7 @@ def random_skill(request, number=None): for x in [random.randrange(0, number_of_skill, 1) for i in range(number)] ] - skill_list = Skill.objects.filter(id__in=selected_skillid_list) + skill_list = Skill.objects.filter(id__in = selected_skillid_list) mylist = [ {"ID": x.id, "Label": str(x), "Difficulty": x.difficulty} for x in skill_list @@ -347,6 +347,75 @@ def random_skill(request, number=None): return render(request, "judge_training_diff.html", context) +def __construct_routine(skill_list, routine): + """ """ + pass + # routine.append(random(skill_list)) + # if len(routine) < 10: + # __construct_routine(skill_list, routine) + + +def suggest_routine(request, difficulty_score, routine_length, max_difficulty_score = None, competition = True, logic = True, gymnast = None, last_jump = None): + """ Propose des séries ayant un score de difficulté donné en paramètre. + """ + + current_routine = [] + + if last_jump: + skill_list = Skill.objects.filter(departure = last_jump.landing) + if logic and last_jump.landing == "Debout": + skill_list = skill_list.exclude(rotationType = last_jump.rotationType) + else: + skill_list = Skill.objects.filter(departure__longLabel = "Debout") + + if competition: + skill_list = skill_list.filter(is_competitive = True) + + if logic and max_difficulty_score: + min_difficulty_score = difficulty_score / 10 + min_difficulty_score -= (min_difficulty_score / 3) + max_difficulty_score = difficulty_score / 10 + max_difficulty_score += (max_difficulty_score / 2) + # logique à terminer d'implémenter... + + for skill in skill_list: + current_routine.append(skill) + current_routine.append( + self.suggest_routine( + request, + difficulty_score - skill.difficulty, + routine_length - 1, + competition, + logic, + gymnast, + skill + ) + ) + current_routine.pop() + # def knapSack(W, wt, val, n): + # K = [[0 for x in range(W+1)] for x in range(n+1)] + # for i in range(n+1): + # for w in range(W+1): + # if i==0 or w==0: + # K[i][w] = 0 + # elif wt[i-1] <= w: + # K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w]) + # else: + # K[i][w] = K[i-1][w] + # return K[n][W] + # val = [60, 100, 120] + # wt = [10, 20, 30] + # W = 50 + # n = len(val) + # print(knapSack(W, wt, val, n)) + # min_difficulty_score = difficulty_score / 10 + # min_difficulty_score -= (min_difficulty_score / 3) + # max_difficulty_score = difficulty_score / 10 + # max_difficulty_score += (max_difficulty_score / 2) + + # skill_list = Skill.objects.filter(difficulty__gte = min_difficulty_score, difficulty__lte = max_difficulty_score) + + @login_required def chrono_listing(request, gymnastid=None, routineid=None): """ diff --git a/src/planning/README.md b/src/planning/README.md new file mode 100644 index 0000000..304d8c5 --- /dev/null +++ b/src/planning/README.md @@ -0,0 +1,26 @@ +# Réflexion concernant le "Système expert" + +Le système devrait tenir compte, dans l'ordre (??), des éléments suivants : + +1. Temps d'entraînement : pour définir le nombre de passages + 1. duration <= 1,5 --> ~15 rounds + 2. duration <= 2 --> ~20 rounds + 3. duration <= 2,5 --> ~25 rounds + 4. duration <= 3 --> ~30 rounds + 5. duration <= 3,5 --> ~35 rounds + 6. duration <= 4 --> ~40 rounds +2. Proposition d'échauffement + 1. Libre ; |1, 2 et 3 ; | & |4 + 2. le nombre d'année de pratique (>3ans) : Si moins ou égale à 3 ans ==> ( et ) ; SdB ; TdB + 3. Série ? +3. Must-Do : avant la prochaine compétition parce qu'il se pourrait qu'il faille apprendre encore des sauts avant la prochaine compétition. Si must-do, prendre la première étape non réalisée vers l'objectif (ou la dernière le temps le permet et que moins de 3 entrainements faits) +4. la prochaine compétition + 1. />12 semaines : travail de série par morceaux de 3 sauts + 2. <12 semaines : travail de série par morceaux de 5 sauts + 3. <9 semaines : travail de série par morceaux de 7 sauts + complète + 4. <6 semaines : travail de série par morceaux de 5 sauts + complète + 5. <3 semaines : plus d'apprentissage de nouveaux sauts, uniquement du maintient d'aquis | travail de série complète + perturbation + 6. <2 semaines : travail de série complète + perturbation + 7. <1 semaine : travail de série complète +5. entrainement passé (3 ou 6 précédents) + diff --git a/src/planning/views.py b/src/planning/views.py index 201be35..a05b3b9 100644 --- a/src/planning/views.py +++ b/src/planning/views.py @@ -763,7 +763,7 @@ def __suggest_new_skill_learning(gymnast, date): def __suggest_technical_routine_work(gymnast, date): """ - Propose des enchaînements autres que ce de la série de compétition + Propose des enchaînements autres que ceux de la série de compétition """ event = ( gymnast.participate_to.filter(datebegin__gte=date).order_by("datebegin").first() @@ -849,14 +849,14 @@ def __suggest_competition_routine_work(gymnast, date): elif event.number_of_week_from_today == 3: # print('il reste moins de 3 semaines') # Travail de L1 - round_list.extend(["L1 + chandelles"]) + round_list.extend(["L1 |"]) round_list.extend(["L1"]) round_list.extend(["L1 avant"]) round_list.extend(["L1"]) round_list.extend(["L1 Arrière"]) round_list.extend(["L1"]) # Travail de L2 - round_list.extend(["L2 + chandelles"]) + round_list.extend(["L2 |"]) round_list.extend(["L2"]) round_list.extend(["L2 avant"]) round_list.extend(["L2"]) @@ -868,14 +868,14 @@ def __suggest_competition_routine_work(gymnast, date): # Travail de L1 round_list.extend(["L1 [-7] 2x"]) round_list.extend(["L1 [4-] 2x"]) - round_list.extend(["L1 + chandelles"]) + round_list.extend(["L1 |"]) round_list.extend(["L1"]) round_list.extend(["L1 avant"]) round_list.extend(["L1 Arrière"]) # Travail de L2 round_list.extend(["L2 [-7] 2x"]) round_list.extend(["L2 [4-] 2x"]) - round_list.extend(["L2 + chandelles"]) + round_list.extend(["L2 |"]) round_list.extend(["L2"]) round_list.extend(["L2 avant"]) round_list.extend(["L2 Arrière"]) @@ -886,13 +886,13 @@ def __suggest_competition_routine_work(gymnast, date): round_list.extend(["L1 [-5] 2x"]) round_list.extend(["L1 [3-8] 2x"]) round_list.extend(["L1 [6-] 2x"]) - round_list.extend(["L1 + chandelles"]) + round_list.extend(["L1 |"]) round_list.extend(["L1"]) # Travail de L2 round_list.extend(["L2 [-5] 2x"]) round_list.extend(["L2 [3-8] 2x"]) round_list.extend(["L2 [6-] 2x"]) - round_list.extend(["L2 + chandelles"]) + round_list.extend(["L2 |"]) round_list.extend(["L2"]) elif event.number_of_week_from_today <= 12: @@ -902,13 +902,13 @@ def __suggest_competition_routine_work(gymnast, date): round_list.extend(["L1 [3-6] 3x"]) round_list.extend(["L1 [5-8] 3x"]) round_list.extend(["L1 [7-] 3x"]) - round_list.extend(["L1 + chandelles"]) + round_list.extend(["L1 |"]) # Travail de L2 round_list.extend(["L2 [-3] 3x"]) round_list.extend(["L2 [3-6] 3x"]) round_list.extend(["L2 [5-8] 3x"]) round_list.extend(["L2 [7-] 3x"]) - round_list.extend(["L2 + chandelles"]) + round_list.extend(["L2 |"]) elif event.number_of_week_from_today <= 16: # round_list.extend(['il reste entre 12 et 16 semaines') @@ -937,12 +937,13 @@ def suggest_program(request, gymnastid, date=pendulum.now().date(), duration=Non fonction doit renvoyer ..todo: - duration <= 1,5 --> 15 rounds - duration <= 2 --> 20 rounds - duration <= 2,5 --> 25 rounds - duration <= 3 --> 30 rounds - duration <= 3,5 --> 35 rounds - duration <= 4 --> 40 rounds + duration <= 1,5 --> 15 rounds (avec échauffement/matériel) + duration <= 2 --> 20 rounds (avec échauffement/matériel) + duration <= 2,5 --> 26 rounds (avec échauffement/matériel) + duration <= 3 --> 33 rounds (avec échauffement/matériel) + duration <= 3,5 --> 40 rounds (avec échauffement/matériel) + duration <= 4 --> 46 rounds (avec échauffement/matériel) + duration <= 4 --> 53 rounds (SANS échauffement/matériel) """ round_list = [] diff --git a/src/templates/login.html b/src/templates/login.html index 21f3c28..59bba18 100644 --- a/src/templates/login.html +++ b/src/templates/login.html @@ -30,6 +30,7 @@ +
diff --git a/src/templates/routine_details.html b/src/templates/routine_details.html index 4844ae5..ed756dd 100644 --- a/src/templates/routine_details.html +++ b/src/templates/routine_details.html @@ -14,11 +14,11 @@ {% if skill_link_list %} - + {% for link in skill_link_list %}