forked from ScoDoc/ScoDoc
BUT: pondération des UE dans les RCUEs
This commit is contained in:
parent
00f66be1c5
commit
8a83e41698
@ -120,8 +120,10 @@ class RegroupementCoherentUE:
|
|||||||
self.moy_ue_2_val = 0.0
|
self.moy_ue_2_val = 0.0
|
||||||
# Calcul de la moyenne au RCUE
|
# Calcul de la moyenne au RCUE
|
||||||
if (self.moy_ue_1 is not None) and (self.moy_ue_2 is not None):
|
if (self.moy_ue_1 is not None) and (self.moy_ue_2 is not None):
|
||||||
# Moyenne RCUE non pondérée (pour le moment -- TODO)
|
# Moyenne RCUE (les pondérations par défaut sont 1.)
|
||||||
self.moy_rcue = (self.moy_ue_1 + self.moy_ue_2) / 2
|
self.moy_rcue = (
|
||||||
|
self.moy_ue_1 * ue_1.coef_rcue + self.moy_ue_2 * ue_2.coef_rcue
|
||||||
|
) / (ue_1.coef_rcue + ue_2.coef_rcue)
|
||||||
else:
|
else:
|
||||||
self.moy_rcue = None
|
self.moy_rcue = None
|
||||||
|
|
||||||
|
@ -40,6 +40,9 @@ class UniteEns(db.Model):
|
|||||||
# coef UE, utilise seulement si l'option use_ue_coefs est activée:
|
# coef UE, utilise seulement si l'option use_ue_coefs est activée:
|
||||||
coefficient = db.Column(db.Float)
|
coefficient = db.Column(db.Float)
|
||||||
|
|
||||||
|
# coef. pour le calcul de moyennes de RCUE. Par défaut, 1.
|
||||||
|
coef_rcue = db.Column(db.Float, nullable=False, default=1.0, server_default="1.0")
|
||||||
|
|
||||||
color = db.Column(db.Text())
|
color = db.Column(db.Text())
|
||||||
|
|
||||||
# BUT
|
# BUT
|
||||||
|
@ -78,6 +78,7 @@ _ueEditor = ndb.EditableTable(
|
|||||||
"is_external",
|
"is_external",
|
||||||
"code_apogee",
|
"code_apogee",
|
||||||
"coefficient",
|
"coefficient",
|
||||||
|
"coef_rcue",
|
||||||
"color",
|
"color",
|
||||||
),
|
),
|
||||||
sortkey="numero",
|
sortkey="numero",
|
||||||
@ -252,6 +253,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
|||||||
initvalues = {
|
initvalues = {
|
||||||
"semestre_idx": default_semestre_idx,
|
"semestre_idx": default_semestre_idx,
|
||||||
"color": ue_guess_color_default(formation_id, default_semestre_idx),
|
"color": ue_guess_color_default(formation_id, default_semestre_idx),
|
||||||
|
"coef_rcue": 1.0,
|
||||||
}
|
}
|
||||||
submitlabel = "Créer cette UE"
|
submitlabel = "Créer cette UE"
|
||||||
can_change_semestre_id = True
|
can_change_semestre_id = True
|
||||||
@ -341,6 +343,25 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
|||||||
"allow_null": not is_apc, # ects requis en APC
|
"allow_null": not is_apc, # ects requis en APC
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
]
|
||||||
|
if is_apc: # coef pour la moyenne RCUE
|
||||||
|
form_descr.append(
|
||||||
|
(
|
||||||
|
"coef_rcue",
|
||||||
|
{
|
||||||
|
"size": 4,
|
||||||
|
"type": "float",
|
||||||
|
"title": "Coef. RCUE",
|
||||||
|
"explanation": """pondération utilisée pour le calcul de la moyenne du RCUE. Laisser à 1, sauf si votre établissement a explicitement décidé de pondérations.
|
||||||
|
""",
|
||||||
|
"defaut": 1.0,
|
||||||
|
"allow_null": False,
|
||||||
|
"enabled": is_apc,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else: # non APC, coef d'UE
|
||||||
|
form_descr.append(
|
||||||
(
|
(
|
||||||
"coefficient",
|
"coefficient",
|
||||||
{
|
{
|
||||||
@ -356,7 +377,9 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
|||||||
""",
|
""",
|
||||||
"enabled": not is_apc,
|
"enabled": not is_apc,
|
||||||
},
|
},
|
||||||
),
|
)
|
||||||
|
)
|
||||||
|
form_descr += [
|
||||||
(
|
(
|
||||||
"ue_code",
|
"ue_code",
|
||||||
{
|
{
|
||||||
|
28
migrations/versions/c0c225192d61_coef_rcue.py
Normal file
28
migrations/versions/c0c225192d61_coef_rcue.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"""coef_rcue
|
||||||
|
|
||||||
|
Revision ID: c0c225192d61
|
||||||
|
Revises: 4311cc342dbd
|
||||||
|
Create Date: 2022-06-24 12:19:58.723862
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'c0c225192d61'
|
||||||
|
down_revision = '4311cc342dbd'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('notes_ue', sa.Column('coef_rcue', sa.Float(), server_default='1.0', nullable=False))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('notes_ue', 'coef_rcue')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user