1
0
forked from ScoDoc/ScoDoc

Assiduités : changement champ desc Table assiduites

This commit is contained in:
iziram 2023-07-20 13:10:26 +02:00
parent a2d9e19122
commit 5ea9944be2
4 changed files with 37 additions and 9 deletions

View File

@ -616,7 +616,7 @@ def assiduite_edit(assiduite_id: int):
# Cas 3 : desc # Cas 3 : desc
desc = data.get("desc", False) desc = data.get("desc", False)
if desc is not False: if desc is not False:
assiduite_unique.desc = desc assiduite_unique.description = desc
# Cas 4 : est_just # Cas 4 : est_just
est_just = data.get("est_just") est_just = data.get("est_just")

View File

@ -53,7 +53,7 @@ class Assiduite(db.Model):
) )
etat = db.Column(db.Integer, nullable=False) etat = db.Column(db.Integer, nullable=False)
desc = db.Column(db.Text) description = db.Column(db.Text)
entry_date = db.Column(db.DateTime(timezone=True), server_default=db.func.now()) entry_date = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
@ -85,7 +85,7 @@ class Assiduite(db.Model):
"date_debut": self.date_debut, "date_debut": self.date_debut,
"date_fin": self.date_fin, "date_fin": self.date_fin,
"etat": etat, "etat": etat,
"desc": self.desc, "desc": self.description,
"entry_date": self.entry_date, "entry_date": self.entry_date,
"user_id": username, "user_id": username,
"est_just": self.est_just, "est_just": self.est_just,
@ -121,7 +121,7 @@ class Assiduite(db.Model):
etat=etat, etat=etat,
etudiant=etud, etudiant=etud,
moduleimpl_id=moduleimpl.id, moduleimpl_id=moduleimpl.id,
desc=description, description=description,
entry_date=entry_date, entry_date=entry_date,
user_id=user_id, user_id=user_id,
est_just=est_just, est_just=est_just,
@ -134,7 +134,7 @@ class Assiduite(db.Model):
date_fin=date_fin, date_fin=date_fin,
etat=etat, etat=etat,
etudiant=etud, etudiant=etud,
desc=description, description=description,
entry_date=entry_date, entry_date=entry_date,
user_id=user_id, user_id=user_id,
est_just=est_just, est_just=est_just,
@ -162,7 +162,7 @@ class Assiduite(db.Model):
etat=etat, etat=etat,
etudid=etudid, etudid=etudid,
moduleimpl_id=moduleimpl_id, moduleimpl_id=moduleimpl_id,
desc=description, description=description,
entry_date=entry_date, entry_date=entry_date,
est_just=est_just, est_just=est_just,
) )

View File

@ -0,0 +1,28 @@
"""assiduites_champ_desc_description
Revision ID: 50f7e0b6229f
Revises: b555390780b2
Create Date: 2023-07-20 12:52:27.882303
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "50f7e0b6229f"
down_revision = "b555390780b2"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column("assiduites", "desc", new_column_name="description")
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column("assiduites", "description", new_column_name="desc")
# ### end Alembic commands ###

View File

@ -129,8 +129,8 @@ class _Merger:
_glob.cursor.execute( _glob.cursor.execute(
"""INSERT INTO assiduites """INSERT INTO assiduites
(etudid,date_debut,date_fin,etat,moduleimpl_id,"desc",entry_date) (etudid,date_debut,date_fin,etat,moduleimpl_id,"description",entry_date)
VALUES (%(etudid)s,%(date_debut)s,%(date_fin)s,%(etat)s,%(moduleimpl_id)s,%(desc)s,%(entry_date)s) VALUES (%(etudid)s,%(date_debut)s,%(date_fin)s,%(etat)s,%(moduleimpl_id)s,%(description)s,%(entry_date)s)
""", """,
{ {
"etudid": self.etudid, "etudid": self.etudid,
@ -138,7 +138,7 @@ class _Merger:
"date_fin": date_fin, "date_fin": date_fin,
"etat": EtatAssiduite.ABSENT, "etat": EtatAssiduite.ABSENT,
"moduleimpl_id": self.moduleimpl, "moduleimpl_id": self.moduleimpl,
"desc": self.raison, "description": self.raison,
"entry_date": self.entry_date, "entry_date": self.entry_date,
}, },
) )