mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
chore: commit qui sert à rien
This commit is contained in:
24
Back-End/School/management/commands/init_establishment.py
Normal file
24
Back-End/School/management/commands/init_establishment.py
Normal file
@ -0,0 +1,24 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from School.models import Establishment, StructureType
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initialize the establishment'
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
establishment_data = {
|
||||
"name": "N3WT",
|
||||
"address": "Société n3wt-innov 69 Chez LANA",
|
||||
"total_capacity": 69,
|
||||
"establishment_type": [StructureType.MATERNELLE, StructureType.PRIMAIRE],
|
||||
"licence_code": ""
|
||||
}
|
||||
|
||||
establishment, created = Establishment.objects.update_or_create(
|
||||
name=establishment_data["name"],
|
||||
defaults=establishment_data
|
||||
)
|
||||
|
||||
if created:
|
||||
self.stdout.write(self.style.SUCCESS('Establishment created successfully'))
|
||||
else:
|
||||
self.stdout.write(self.style.SUCCESS('Establishment updated successfully'))
|
||||
@ -1,5 +1,5 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from School.models import PaymentMode, PaymentModeType, FeeType
|
||||
from School.models import PaymentMode, PaymentModeType, FeeType, Establishment
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initialize or update Payment Modes'
|
||||
@ -8,6 +8,7 @@ class Command(BaseCommand):
|
||||
self.create_or_update_payment_modes()
|
||||
|
||||
def create_or_update_payment_modes(self):
|
||||
establishment = Establishment.objects.get(name="N3WT")
|
||||
for fee_type in FeeType.choices:
|
||||
fee_type_value = fee_type[0]
|
||||
|
||||
@ -18,7 +19,8 @@ class Command(BaseCommand):
|
||||
mode=mode_value,
|
||||
type=fee_type_value,
|
||||
defaults={
|
||||
'is_active': False
|
||||
'is_active': False,
|
||||
'establishment': establishment
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from School.models import PaymentPlan, PaymentPlanType, FeeType
|
||||
from School.models import PaymentPlan, PaymentPlanType, FeeType, Establishment
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initialize or update Payment Plans'
|
||||
@ -11,6 +11,7 @@ class Command(BaseCommand):
|
||||
|
||||
def create_or_update_payment_plans(self):
|
||||
current_date = timezone.now().date()
|
||||
establishment = Establishment.objects.get(name="N3WT")
|
||||
|
||||
for fee_type in FeeType.choices:
|
||||
fee_type_value = fee_type[0]
|
||||
@ -21,7 +22,8 @@ class Command(BaseCommand):
|
||||
type=fee_type_value,
|
||||
defaults={
|
||||
'due_dates': [current_date + relativedelta(months=1)],
|
||||
'is_active': True
|
||||
'is_active': True,
|
||||
'establishment': establishment
|
||||
}
|
||||
)
|
||||
|
||||
@ -31,7 +33,8 @@ class Command(BaseCommand):
|
||||
type=fee_type_value,
|
||||
defaults={
|
||||
'due_dates': [current_date + relativedelta(months=1+4*i) for i in range(3)],
|
||||
'is_active': False
|
||||
'is_active': False,
|
||||
'establishment': establishment
|
||||
}
|
||||
)
|
||||
|
||||
@ -41,7 +44,8 @@ class Command(BaseCommand):
|
||||
type=fee_type_value,
|
||||
defaults={
|
||||
'due_dates': [current_date + relativedelta(months=1+i) for i in range(10)],
|
||||
'is_active': False
|
||||
'is_active': False,
|
||||
'establishment': establishment
|
||||
}
|
||||
)
|
||||
|
||||
@ -51,7 +55,8 @@ class Command(BaseCommand):
|
||||
type=fee_type_value,
|
||||
defaults={
|
||||
'due_dates': [current_date + relativedelta(months=1+i) for i in range(12)],
|
||||
'is_active': False
|
||||
'is_active': False,
|
||||
'establishment': establishment
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from Auth.models import Profile
|
||||
from School.models import Speciality, Teacher, SchoolClass
|
||||
from School.models import Speciality, Teacher, SchoolClass, Establishment
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initialize or update Fees and Discounts'
|
||||
@ -108,6 +108,7 @@ class Command(BaseCommand):
|
||||
self.stdout.write(self.style.SUCCESS('Teachers initialized or updated successfully'))
|
||||
|
||||
def create_or_update_schoolClasses(self):
|
||||
establishment = Establishment.objects.get(name="N3WT")
|
||||
school_classes_data = [
|
||||
{
|
||||
"atmosphere_name": "Classe A",
|
||||
@ -119,7 +120,8 @@ class Command(BaseCommand):
|
||||
"type": 1,
|
||||
"time_range": ["08:30", "17:30"],
|
||||
"opening_days": [1, 2, 4, 5],
|
||||
"teachers": [2] # ID of Severus Rogue
|
||||
"teachers": [2], # ID of Severus Rogue
|
||||
"establishment": establishment
|
||||
},
|
||||
{
|
||||
"atmosphere_name": "Classe B",
|
||||
@ -131,7 +133,8 @@ class Command(BaseCommand):
|
||||
"type": 1,
|
||||
"time_range": ["08:30", "17:30"],
|
||||
"opening_days": [1, 2, 4, 5],
|
||||
"teachers": [3] # ID of Minerva McGonagall
|
||||
"teachers": [3], # ID of Minerva McGonagall
|
||||
"establishment": establishment
|
||||
},
|
||||
{
|
||||
"atmosphere_name": "Classe C",
|
||||
@ -143,7 +146,8 @@ class Command(BaseCommand):
|
||||
"type": 1,
|
||||
"time_range": ["08:30", "17:30"],
|
||||
"opening_days": [1, 2, 4, 5],
|
||||
"teachers": [4] # ID of Pomona Chourave
|
||||
"teachers": [4], # ID of Pomona Chourave
|
||||
"establishment": establishment
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from Auth.models import Profile
|
||||
from School.models import Fee, Discount, FeeType, DiscountType
|
||||
from School.models import Fee, Discount, FeeType, DiscountType, Establishment
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Initialize or update Fees and Discounts'
|
||||
@ -10,41 +10,47 @@ class Command(BaseCommand):
|
||||
self.create_or_update_discounts()
|
||||
|
||||
def create_or_update_fees(self):
|
||||
establishment = Establishment.objects.get(name="N3WT")
|
||||
fees_data = [
|
||||
{
|
||||
"name": "Frais d'inscription",
|
||||
"base_amount": "150.00",
|
||||
"description": "Montant de base",
|
||||
"is_active": True,
|
||||
"type": FeeType.REGISTRATION_FEE
|
||||
"type": FeeType.REGISTRATION_FEE,
|
||||
"establishment": establishment
|
||||
},
|
||||
{
|
||||
"name": "Matériel",
|
||||
"base_amount": "85.00",
|
||||
"description": "Livres / jouets",
|
||||
"is_active": True,
|
||||
"type": FeeType.REGISTRATION_FEE
|
||||
"type": FeeType.REGISTRATION_FEE,
|
||||
"establishment": establishment
|
||||
},
|
||||
{
|
||||
"name": "Sorties périscolaires",
|
||||
"base_amount": "120.00",
|
||||
"description": "Sorties",
|
||||
"is_active": True,
|
||||
"type": FeeType.REGISTRATION_FEE
|
||||
"type": FeeType.REGISTRATION_FEE,
|
||||
"establishment": establishment
|
||||
},
|
||||
{
|
||||
"name": "Les colibris",
|
||||
"base_amount": "4500.00",
|
||||
"description": "TPS / PS / MS / GS",
|
||||
"is_active": True,
|
||||
"type": FeeType.TUITION_FEE
|
||||
"type": FeeType.TUITION_FEE,
|
||||
"establishment": establishment
|
||||
},
|
||||
{
|
||||
"name": "Les butterflies",
|
||||
"base_amount": "5000.00",
|
||||
"description": "CP / CE1 / CE2 / CM1 / CM2",
|
||||
"is_active": True,
|
||||
"type": FeeType.TUITION_FEE
|
||||
"type": FeeType.TUITION_FEE,
|
||||
"establishment": establishment
|
||||
}
|
||||
]
|
||||
|
||||
@ -58,20 +64,23 @@ class Command(BaseCommand):
|
||||
self.stdout.write(self.style.SUCCESS('Fees initialized or updated successfully'))
|
||||
|
||||
def create_or_update_discounts(self):
|
||||
establishment = Establishment.objects.get(name="N3WT")
|
||||
discounts_data = [
|
||||
{
|
||||
"name": "Parrainage",
|
||||
"amount": "10.00",
|
||||
"description": "Réduction pour parrainage",
|
||||
"discount_type": DiscountType.PERCENT,
|
||||
"type": FeeType.TUITION_FEE
|
||||
"type": FeeType.TUITION_FEE,
|
||||
"establishment": establishment
|
||||
},
|
||||
{
|
||||
"name": "Réinscription",
|
||||
"amount": "100.00",
|
||||
"description": "Réduction pour Réinscription",
|
||||
"discount_type": DiscountType.PERCENT,
|
||||
"type": FeeType.REGISTRATION_FEE
|
||||
"type": FeeType.REGISTRATION_FEE,
|
||||
"establishment": establishment
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user