30 lines
935 B
Python
30 lines
935 B
Python
|
"""This command manages Closure Tables implementation
|
||
|
|
||
|
It adds new levels and cleans links between Educatives.
|
||
|
This way, it's relatively easy to fetch an entire tree with just one tiny request.
|
||
|
|
||
|
"""
|
||
|
import pendulum
|
||
|
|
||
|
from django.core.management.base import BaseCommand
|
||
|
|
||
|
from jarvis.followup.models import Intensity
|
||
|
|
||
|
|
||
|
class Command(BaseCommand):
|
||
|
def handle(self, *args, **options):
|
||
|
today = pendulum.date(2024, 1, 31)
|
||
|
intensity_list = Intensity.objects.filter(date__lte=today)
|
||
|
count = 0
|
||
|
|
||
|
for intensity in intensity_list:
|
||
|
count += 1
|
||
|
|
||
|
intensity.theorical_time = intensity.time
|
||
|
intensity.difficulty_asked = intensity.difficulty
|
||
|
intensity.number_of_passes_asked = intensity.number_of_passes
|
||
|
intensity.quantity_of_skill_asked = intensity.quantity_of_skill
|
||
|
intensity.save()
|
||
|
|
||
|
print(f"Traitement de {count} intensité terminés")
|