2020-09-26 16:19:37 +02:00
# -*- mode: python -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Gestion scolarite IUT
#
2022-01-01 14:49:42 +01:00
# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved.
2020-09-26 16:19:37 +02:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Emmanuel Viennet emmanuel.viennet@viennet.net
#
##############################################################################
""" Tableau de bord module
"""
2021-01-17 22:31:28 +01:00
import time
2020-09-26 16:19:37 +02:00
2021-07-20 06:53:05 +02:00
from flask import g , url_for
2021-07-31 18:01:10 +02:00
from flask_login import current_user
2021-07-20 06:53:05 +02:00
2021-12-19 11:08:03 +01:00
from app . auth . models import User
2022-02-10 15:29:51 +01:00
from app . comp import res_sem
2022-03-27 22:25:00 +02:00
from app . comp . res_compat import NotesTableCompat
2021-11-29 22:18:37 +01:00
from app . models import ModuleImpl
2021-12-19 11:08:03 +01:00
from app . models . evaluations import Evaluation
2021-06-19 23:21:37 +02:00
import app . scodoc . sco_utils as scu
2022-01-11 22:44:03 +01:00
from app . scodoc . sco_exceptions import ScoInvalidIdType
2022-07-07 16:24:52 +02:00
from app . scodoc . sco_cursus_dut import formsemestre_has_decisions
2021-06-19 23:21:37 +02:00
from app . scodoc . sco_permissions import Permission
2021-01-17 22:31:28 +01:00
2021-06-19 23:21:37 +02:00
from app . scodoc import html_sco_header
from app . scodoc import htmlutils
from app . scodoc import sco_abs
from app . scodoc import sco_compute_moy
2021-07-19 19:53:01 +02:00
from app . scodoc import sco_cache
2021-06-19 23:21:37 +02:00
from app . scodoc import sco_edit_module
from app . scodoc import sco_evaluations
2021-11-12 22:17:46 +01:00
from app . scodoc import sco_evaluation_db
2021-06-19 23:21:37 +02:00
from app . scodoc import sco_formations
from app . scodoc import sco_formsemestre
from app . scodoc import sco_formsemestre_status
from app . scodoc import sco_groups
from app . scodoc import sco_moduleimpl
from app . scodoc import sco_permissions_check
2021-07-03 23:35:32 +02:00
from app . scodoc import sco_users
2020-09-26 16:19:37 +02:00
# ported from old DTML code in oct 2009
# menu evaluation dans moduleimpl
2021-09-27 10:20:10 +02:00
def moduleimpl_evaluation_menu ( evaluation_id , nbnotes = 0 ) :
2020-09-26 16:19:37 +02:00
" Menu avec actions sur une evaluation "
2021-11-12 22:17:46 +01:00
E = sco_evaluation_db . do_evaluation_list ( { " evaluation_id " : evaluation_id } ) [ 0 ]
2021-10-15 14:00:51 +02:00
modimpl = sco_moduleimpl . moduleimpl_list ( moduleimpl_id = E [ " moduleimpl_id " ] ) [ 0 ]
2020-09-26 16:19:37 +02:00
2021-07-29 16:31:15 +02:00
group_id = sco_groups . get_default_group ( modimpl [ " formsemestre_id " ] )
2020-09-26 16:19:37 +02:00
if (
2021-06-19 23:21:37 +02:00
sco_permissions_check . can_edit_notes (
2021-09-18 13:42:19 +02:00
current_user , E [ " moduleimpl_id " ] , allow_ens = False
2020-09-26 16:19:37 +02:00
)
and nbnotes != 0
) :
sup_label = " Supprimer évaluation impossible (il y a des notes) "
else :
sup_label = " Supprimer évaluation "
menuEval = [
{
" title " : " Saisir notes " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.saisie_notes " ,
" args " : {
" evaluation_id " : evaluation_id ,
} ,
2021-06-19 23:21:37 +02:00
" enabled " : sco_permissions_check . can_edit_notes (
2021-09-18 13:42:19 +02:00
current_user , E [ " moduleimpl_id " ]
2020-09-26 16:19:37 +02:00
) ,
} ,
{
" title " : " Modifier évaluation " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.evaluation_edit " ,
" args " : {
" evaluation_id " : evaluation_id ,
} ,
2021-06-19 23:21:37 +02:00
" enabled " : sco_permissions_check . can_edit_notes (
2021-09-18 13:42:19 +02:00
current_user , E [ " moduleimpl_id " ] , allow_ens = False
2020-09-26 16:19:37 +02:00
) ,
} ,
{
" title " : sup_label ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.evaluation_delete " ,
" args " : {
" evaluation_id " : evaluation_id ,
} ,
2020-09-26 16:19:37 +02:00
" enabled " : nbnotes == 0
2021-06-19 23:21:37 +02:00
and sco_permissions_check . can_edit_notes (
2021-09-18 13:42:19 +02:00
current_user , E [ " moduleimpl_id " ] , allow_ens = False
2020-09-26 16:19:37 +02:00
) ,
} ,
{
" title " : " Supprimer toutes les notes " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.evaluation_suppress_alln " ,
" args " : {
" evaluation_id " : evaluation_id ,
} ,
2021-06-19 23:21:37 +02:00
" enabled " : sco_permissions_check . can_edit_notes (
2021-09-18 13:42:19 +02:00
current_user , E [ " moduleimpl_id " ] , allow_ens = False
2020-09-26 16:19:37 +02:00
) ,
} ,
{
" title " : " Afficher les notes " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.evaluation_listenotes " ,
" args " : {
" evaluation_id " : evaluation_id ,
} ,
2020-09-26 16:19:37 +02:00
" enabled " : nbnotes > 0 ,
} ,
{
" title " : " Placement étudiants " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.placement_eval_selectetuds " ,
" args " : {
" evaluation_id " : evaluation_id ,
} ,
2021-09-18 14:21:15 +02:00
" enabled " : sco_permissions_check . can_edit_notes (
current_user , E [ " moduleimpl_id " ]
) ,
2020-09-26 16:19:37 +02:00
} ,
{
" title " : " Absences ce jour " ,
2021-06-19 23:21:37 +02:00
" endpoint " : " absences.EtatAbsencesDate " ,
" args " : {
2021-11-06 16:35:21 +01:00
" date " : E [ " jour " ] ,
2021-06-19 23:21:37 +02:00
" group_ids " : group_id ,
} ,
2020-09-26 16:19:37 +02:00
" enabled " : E [ " jour " ] ,
} ,
{
" title " : " Vérifier notes vs absents " ,
2021-06-14 18:08:52 +02:00
" endpoint " : " notes.evaluation_check_absences_html " ,
" args " : {
" evaluation_id " : evaluation_id ,
} ,
2020-09-26 16:19:37 +02:00
" enabled " : nbnotes > 0 and E [ " jour " ] ,
} ,
]
2021-01-17 22:31:28 +01:00
return htmlutils . make_menu ( " actions " , menuEval , alone = True )
2020-09-26 16:19:37 +02:00
2022-01-06 22:42:26 +01:00
def _ue_coefs_html ( coefs_lst ) - > str :
2021-12-02 21:16:14 +01:00
""" """
2022-01-06 22:42:26 +01:00
max_coef = max ( [ x [ 1 ] for x in coefs_lst ] ) if coefs_lst else 1.0
2021-12-02 21:16:14 +01:00
H = """
< div id = " modimpl_coefs " >
< div > Coefficients vers les UE < / div >
"""
2022-01-06 22:42:26 +01:00
if coefs_lst :
H + = (
f """
2021-12-02 21:16:14 +01:00
< div class = " coefs_histo " style = " --max: {max_coef} " >
2022-01-06 22:42:26 +01:00
"""
+ " \n " . join (
[
2022-01-25 10:45:13 +01:00
f """ <div style= " --coef: { coef } ;
{ ' background-color: ' + ue . color + ' ; ' if ue . color else ' ' }
" ><div> {coef} </div> {ue.acronyme} </div> " " "
2022-01-06 22:42:26 +01:00
for ue , coef in coefs_lst
]
)
+ " </div> "
2021-12-02 21:16:14 +01:00
)
else :
2022-01-06 22:42:26 +01:00
H + = """ <div class= " missing_value " >non définis</div> """
H + = " </div> "
2021-12-02 21:16:14 +01:00
return H
2021-09-27 10:20:10 +02:00
def moduleimpl_status ( moduleimpl_id = None , partition_id = None ) :
2020-09-26 16:19:37 +02:00
""" Tableau de bord module (liste des evaluations etc) """
2022-01-11 22:44:03 +01:00
if not isinstance ( moduleimpl_id , int ) :
raise ScoInvalidIdType ( " moduleimpl_id must be an integer ! " )
2022-06-24 03:34:52 +02:00
modimpl : ModuleImpl = ModuleImpl . query . get_or_404 ( moduleimpl_id )
2021-11-29 22:18:37 +01:00
M = modimpl . to_dict ( )
2022-04-29 08:17:04 +02:00
formsemestre_id = modimpl . formsemestre_id
Mod = sco_edit_module . module_list ( args = { " module_id " : modimpl . module_id } ) [ 0 ]
2021-08-19 10:28:35 +02:00
sem = sco_formsemestre . get_formsemestre ( formsemestre_id )
F = sco_formations . formation_list ( args = { " formation_id " : sem [ " formation_id " ] } ) [ 0 ]
2021-11-12 22:17:46 +01:00
mod_inscrits = sco_moduleimpl . do_moduleimpl_inscription_list (
2021-08-20 01:09:55 +02:00
moduleimpl_id = M [ " moduleimpl_id " ]
2020-09-26 16:19:37 +02:00
)
2022-02-10 15:29:51 +01:00
nt : NotesTableCompat = res_sem . load_formsemestre_results ( modimpl . formsemestre )
2021-11-12 22:17:46 +01:00
mod_evals = sco_evaluation_db . do_evaluation_list ( { " moduleimpl_id " : moduleimpl_id } )
mod_evals . sort (
2020-09-26 16:19:37 +02:00
key = lambda x : ( x [ " numero " ] , x [ " jour " ] , x [ " heure_debut " ] ) , reverse = True
) # la plus RECENTE en tête
#
2022-04-28 07:06:01 +02:00
sem_locked = not sem [ " etat " ]
can_edit_evals = (
sco_permissions_check . can_edit_notes (
current_user , moduleimpl_id , allow_ens = sem [ " ens_can_edit_eval " ]
)
and not sem_locked
)
can_edit_notes = (
sco_permissions_check . can_edit_notes ( current_user , moduleimpl_id )
and not sem_locked
2020-09-26 16:19:37 +02:00
)
2021-10-12 16:05:50 +02:00
arrow_up , arrow_down , arrow_none = sco_groups . get_arrow_icons_tags ( )
2020-09-26 16:19:37 +02:00
#
2021-08-21 23:45:48 +02:00
module_resp = User . query . get ( M [ " responsable_id " ] )
2021-11-12 22:17:46 +01:00
mod_type_name = scu . MODULE_TYPE_NAMES [ Mod [ " module_type " ] ]
2020-09-26 16:19:37 +02:00
H = [
2021-12-11 10:57:06 +01:00
html_sco_header . sco_header (
page_title = f " { mod_type_name } { Mod [ ' code ' ] } { Mod [ ' titre ' ] } "
) ,
2021-11-12 22:17:46 +01:00
f """ <h2 class= " formsemestre " > { mod_type_name }
2022-02-01 11:37:05 +01:00
< tt > { Mod [ ' code ' ] } < / tt > { Mod [ ' titre ' ] }
{ " dans l ' UE " + modimpl . module . ue . acronyme if modimpl . module . module_type == scu . ModuleType . MALUS else " " }
< / h2 >
2021-11-12 22:17:46 +01:00
< div class = " moduleimpl_tableaubord moduleimpl_type_ {
scu . ModuleType ( Mod [ ' module_type ' ] ) . name . lower ( ) } " >
< table >
< tr >
< td class = " fichetitre2 " > Responsable : < / td > < td class = " redboldtext " >
{ module_resp . get_nomcomplet ( ) }
< span class = " blacktt " > ( { module_resp . user_name } ) < / span >
""" ,
2020-09-26 16:19:37 +02:00
]
try :
2021-09-27 10:20:10 +02:00
sco_moduleimpl . can_change_module_resp ( moduleimpl_id )
2020-09-26 16:19:37 +02:00
H . append (
""" <a class= " stdlink " href= " edit_moduleimpl_resp?moduleimpl_id= %s " >modifier</a> """
% moduleimpl_id
)
except :
pass
H . append ( """ </td><td> """ )
H . append (
2021-07-03 23:35:32 +02:00
" , " . join ( [ sco_users . user_info ( m [ " ens_id " ] ) [ " nomprenom " ] for m in M [ " ens " ] ] )
2020-09-26 16:19:37 +02:00
)
H . append ( """ </td><td> """ )
try :
2021-08-22 13:24:36 +02:00
sco_moduleimpl . can_change_ens ( moduleimpl_id )
2020-09-26 16:19:37 +02:00
H . append (
""" <a class= " stdlink " href= " edit_enseignants_form?moduleimpl_id= %s " >modifier les enseignants</a> """
% moduleimpl_id
)
except :
pass
H . append ( """ </td></tr> """ )
# 2ieme ligne: Semestre, Coef
H . append ( """ <tr><td class= " fichetitre2 " > """ )
if sem [ " semestre_id " ] > = 0 :
H . append ( """ Semestre: </td><td> %s """ % sem [ " semestre_id " ] )
else :
H . append ( """ </td><td> """ )
2022-04-28 07:06:01 +02:00
if sem_locked :
2021-01-17 22:31:28 +01:00
H . append ( scu . icontag ( " lock32_img " , title = " verrouillé " ) )
2021-12-02 21:16:14 +01:00
H . append ( """ </td><td class= " fichetitre2 " > """ )
2021-11-29 22:18:37 +01:00
if modimpl . module . is_apc ( ) :
2022-01-06 22:42:26 +01:00
H . append ( _ue_coefs_html ( modimpl . module . ue_coefs_list ( ) ) )
2021-11-29 22:18:37 +01:00
else :
2022-06-02 11:37:13 +02:00
H . append (
f """ Coef. dans le semestre: {
" non défini " if modimpl . module . coefficient is None else modimpl . module . coefficient
} """
)
2021-11-29 22:18:37 +01:00
H . append ( """ </td><td></td></tr> """ )
2020-09-26 16:19:37 +02:00
# 3ieme ligne: Formation
H . append (
""" <tr><td class= " fichetitre2 " >Formation: </td><td> %(titre)s </td></tr> """ % F
)
# Ligne: Inscrits
H . append (
""" <tr><td class= " fichetitre2 " >Inscrits: </td><td> %d étudiants """
2021-11-12 22:17:46 +01:00
% len ( mod_inscrits )
2020-09-26 16:19:37 +02:00
)
2021-07-31 18:01:10 +02:00
if current_user . has_permission ( Permission . ScoEtudInscrit ) :
2020-09-26 16:19:37 +02:00
H . append (
""" <a class= " stdlink " style= " margin-left:2em; " href= " moduleimpl_inscriptions_edit?moduleimpl_id= %s " >modifier</a> """
% M [ " moduleimpl_id " ]
)
H . append ( " </td></tr> " )
# Ligne: règle de calcul
2021-08-21 00:24:51 +02:00
has_expression = sco_compute_moy . moduleimpl_has_expression ( M )
2020-09-26 16:19:37 +02:00
if has_expression :
H . append (
' <tr><td class= " fichetitre2 " colspan= " 4 " >Règle de calcul: <span class= " formula " title= " mode de calcul de la moyenne du module " >moyenne=<tt> %s </tt></span> '
% M [ " computation_expr " ]
)
2022-08-04 09:06:58 +02:00
H . append ( """ <span class= " warning " >inutilisée dans cette version de ScoDoc """ )
if sco_moduleimpl . can_change_ens ( moduleimpl_id , raise_exc = False ) :
H . append (
f """ <a href= " {
url_for ( " notes.delete_moduleimpl_expr " , scodoc_dept = g . scodoc_dept ,
moduleimpl_id = moduleimpl_id )
} " class= " stdlink " >supprimer</a> " " "
)
H . append ( """ </span> """ )
2020-09-26 16:19:37 +02:00
H . append ( " </td></tr> " )
else :
H . append (
2022-01-30 22:03:14 +01:00
' <tr><td colspan= " 4 " > ' # <em title="mode de calcul de la moyenne du module">règle de calcul standard</em>'
2020-09-26 16:19:37 +02:00
)
2022-01-30 22:03:14 +01:00
# if sco_moduleimpl.can_change_ens(moduleimpl_id, raise_exc=False):
# H.append(
# f' (<a class="stdlink" href="edit_moduleimpl_expr?moduleimpl_id={moduleimpl_id}">changer</a>)'
# )
2020-09-26 16:19:37 +02:00
H . append ( " </td></tr> " )
H . append (
2021-01-02 22:07:38 +01:00
' <tr><td colspan= " 4 " ><span class= " moduleimpl_abs_link " ><a class= " stdlink " href= " view_module_abs?moduleimpl_id= %s " >Absences dans ce module</a></span> '
2020-09-26 16:19:37 +02:00
% moduleimpl_id
)
2021-01-02 22:07:38 +01:00
# Adapté à partir d'une suggestion de DS (Le Havre)
# Liens saisies absences seulement si permission et date courante dans le semestre
2021-07-31 18:01:10 +02:00
if current_user . has_permission (
2021-06-19 23:21:37 +02:00
Permission . ScoAbsChange
2021-08-21 00:24:51 +02:00
) and sco_formsemestre . sem_est_courant ( sem ) :
2021-01-10 18:54:39 +01:00
datelundi = sco_abs . ddmmyyyy ( time . strftime ( " %d / % m/ % Y " ) ) . prev_monday ( )
2021-07-29 16:31:15 +02:00
group_id = sco_groups . get_default_group ( formsemestre_id )
2021-01-02 22:07:38 +01:00
H . append (
2021-07-20 06:53:05 +02:00
f """
< span class = " moduleimpl_abs_link " > < a class = " stdlink "
href = " { url_for( " absences . SignaleAbsenceGrHebdo " ,
scodoc_dept = g . scodoc_dept , formsemestre_id = formsemestre_id ,
moduleimpl_id = moduleimpl_id , datelundi = datelundi , group_ids = group_id ) } " >
Saisie Absences hebdo . < / a > < / span >
"""
2021-01-02 22:07:38 +01:00
)
H . append ( " </td></tr></table> " )
2020-09-26 16:19:37 +02:00
#
2021-11-29 22:18:37 +01:00
if not modimpl . check_apc_conformity ( ) :
H . append (
2022-01-06 22:42:26 +01:00
""" <div class= " warning conformite " >Les poids des évaluations de ce module ne sont
pas encore conformes au PN .
2021-11-29 22:18:37 +01:00
Ses notes ne peuvent pas être prises en compte dans les moyennes d ' UE.
2022-01-06 22:42:26 +01:00
< / div > """
2021-11-29 22:18:37 +01:00
)
#
2020-09-26 16:19:37 +02:00
if has_expression and nt . expr_diagnostics :
2021-08-21 00:24:51 +02:00
H . append ( sco_formsemestre_status . html_expr_diagnostic ( nt . expr_diagnostics ) )
2020-09-26 16:19:37 +02:00
#
2022-02-10 15:29:51 +01:00
if formsemestre_has_decisions ( formsemestre_id ) :
2020-09-26 16:19:37 +02:00
H . append (
""" <ul class= " tf-msg " ><li class= " tf-msg warning " >Décisions de jury saisies: seul le responsable du semestre peut saisir des notes (il devra modifier les décisions de jury).</li></ul> """
)
#
H . append (
""" <p><form name= " f " ><span style= " font-size:120 %% ; font-weight: bold; " > %d évaluations :</span>
< span style = " padding-left: 30px; " >
< input type = " hidden " name = " moduleimpl_id " value = " %s " / > """
2021-11-12 22:17:46 +01:00
% ( len ( mod_evals ) , moduleimpl_id )
2020-09-26 16:19:37 +02:00
)
#
# Liste les noms de partitions
2021-08-19 10:28:35 +02:00
partitions = sco_groups . get_partitions_list ( sem [ " formsemestre_id " ] )
2020-09-26 16:19:37 +02:00
H . append (
""" Afficher les groupes de <select name= " partition_id " onchange= " document.f.submit(); " > """
)
2020-12-26 00:39:45 +01:00
been_selected = False
2020-09-26 16:19:37 +02:00
for partition in partitions :
2020-12-26 00:39:45 +01:00
if not partition_id and not been_selected :
selected = " selected "
been_selected = True
2020-09-26 16:19:37 +02:00
if partition [ " partition_id " ] == partition_id :
selected = " selected "
else :
selected = " "
name = partition [ " partition_name " ]
if name is None :
name = " Tous "
H . append (
""" <option value= " %s " %s > %s </option> """
% ( partition [ " partition_id " ] , selected , name )
)
H . append (
""" </select>
& nbsp ; & nbsp ; & nbsp ; & nbsp ;
< a class = " stdlink " href = " evaluation_listenotes?moduleimpl_id= %(moduleimpl_id)s " > Voir toutes les notes < / a >
< / span >
< / form >
< / p >
"""
% M
)
# -------- Tableau des evaluations
top_table_links = " "
2022-04-28 07:06:01 +02:00
if can_edit_evals :
top_table_links = f """ <a class= " stdlink " href= " {
url_for ( " notes.evaluation_create " , scodoc_dept = g . scodoc_dept , moduleimpl_id = M [ ' moduleimpl_id ' ] )
} " >Créer nouvelle évaluation</a>
< a class = " stdlink " style = " margin-left:2em; " href = " {
url_for ( " notes.module_evaluation_renumber " , scodoc_dept = g . scodoc_dept , moduleimpl_id = M [ ' moduleimpl_id ' ] ,
redirect = 1 )
} " >Trier par date</a>
"""
2021-11-12 22:17:46 +01:00
if mod_evals :
2020-09-26 16:19:37 +02:00
H . append (
' <div class= " moduleimpl_evaluations_top_links " > '
+ top_table_links
+ " </div> "
)
H . append ( """ <table class= " moduleimpl_evaluations " > """ )
2021-11-12 22:17:46 +01:00
eval_index = len ( mod_evals ) - 1
2021-12-19 11:08:03 +01:00
first_eval = True
2021-11-12 22:17:46 +01:00
for eval in mod_evals :
2022-01-20 13:00:25 +01:00
evaluation : Evaluation = Evaluation . query . get (
eval [ " evaluation_id " ]
) # TODO unifier
2020-09-26 16:19:37 +02:00
etat = sco_evaluations . do_evaluation_etat (
eval [ " evaluation_id " ] ,
partition_id = partition_id ,
select_first_partition = True ,
)
2021-06-19 23:21:37 +02:00
if eval [ " evaluation_type " ] in (
scu . EVALUATION_RATTRAPAGE ,
scu . EVALUATION_SESSION2 ,
) :
2021-03-11 14:49:37 +01:00
tr_class = " mievr mievr_rattr "
2020-09-26 16:19:37 +02:00
else :
tr_class = " mievr "
tr_class_1 = " mievr "
2021-12-19 11:08:03 +01:00
if not first_eval :
2020-09-26 16:19:37 +02:00
H . append ( """ <tr><td colspan= " 8 " > </td></tr> """ )
tr_class_1 + = " mievr_spaced "
H . append ( """ <tr class= " %s " ><td class= " mievr_tit " colspan= " 8 " > """ % tr_class_1 )
if eval [ " jour " ] :
H . append ( """ Le %(jour)s %(descrheure)s """ % eval )
else :
H . append (
""" <a href= " evaluation_edit?evaluation_id= %(evaluation_id)s " class= " mievr_evalnodate " >Evaluation sans date</a> """
% eval
)
H . append ( " <em> %(description)s </em> " % eval )
2021-06-19 23:21:37 +02:00
if eval [ " evaluation_type " ] == scu . EVALUATION_RATTRAPAGE :
2021-03-11 14:49:37 +01:00
H . append (
""" <span class= " mievr_rattr " title= " remplace si meilleure note " >rattrapage</span> """
)
2021-06-19 23:21:37 +02:00
elif eval [ " evaluation_type " ] == scu . EVALUATION_SESSION2 :
2021-03-11 14:49:37 +01:00
H . append (
""" <span class= " mievr_rattr " title= " remplace autres notes " >session 2</span> """
)
2020-09-26 16:19:37 +02:00
if etat [ " last_modif " ] :
H . append (
""" <span class= " mievr_lastmodif " >(dernière modif le %s )</span> """
% etat [ " last_modif " ] . strftime ( " %d / % m/ % Y à % Hh % M " )
)
H . append ( ' <span class= " evalindex_cont " > ' )
2020-12-23 22:27:21 +01:00
if has_expression or True :
2020-09-26 16:19:37 +02:00
H . append (
2020-12-23 22:27:21 +01:00
""" <span class= " evalindex " title= " Indice dans les vecteurs (formules) " > %2d </span> """
2020-09-26 16:19:37 +02:00
% eval_index
)
# Fleches:
H . append ( ' <span class= " eval_arrows_chld " > ' )
2022-04-28 07:06:01 +02:00
if eval_index != ( len ( mod_evals ) - 1 ) and can_edit_evals :
2020-09-26 16:19:37 +02:00
H . append (
2021-05-11 11:48:32 +02:00
' <a href= " module_evaluation_move?evaluation_id= %s &after=0 " class= " aud " > %s </a> '
2020-09-26 16:19:37 +02:00
% ( eval [ " evaluation_id " ] , arrow_up )
)
else :
H . append ( arrow_none )
2022-04-28 07:06:01 +02:00
if ( eval_index > 0 ) and can_edit_evals :
2020-09-26 16:19:37 +02:00
H . append (
2021-05-11 11:48:32 +02:00
' <a href= " module_evaluation_move?evaluation_id= %s &after=1 " class= " aud " > %s </a> '
2020-09-26 16:19:37 +02:00
% ( eval [ " evaluation_id " ] , arrow_down )
)
else :
H . append ( arrow_none )
H . append ( " </span></span> " )
eval_index - = 1
H . append ( """ </td></tr> """ )
H . append (
""" <tr class= " %s " ><th class= " moduleimpl_evaluations " colspan= " 2 " > </th><th class= " moduleimpl_evaluations " >Durée</th><th class= " moduleimpl_evaluations " >Coef.</th><th class= " moduleimpl_evaluations " >Notes</th><th class= " moduleimpl_evaluations " >Abs</th><th class= " moduleimpl_evaluations " >N</th><th class= " moduleimpl_evaluations " >Moyenne """
% tr_class
)
if etat [ " evalcomplete " ] :
etat_txt = """ (prise en compte) """
etat_descr = " notes utilisées dans les moyennes "
2021-08-11 00:36:07 +02:00
elif eval [ " publish_incomplete " ] :
2020-09-26 16:19:37 +02:00
etat_txt = """ (prise en compte <b>immédiate</b>) """
etat_descr = (
" il manque des notes, mais la prise en compte immédiate a été demandée "
)
elif etat [ " nb_notes " ] != 0 :
etat_txt = " (<b>non</b> prise en compte) "
etat_descr = " il manque des notes "
else :
etat_txt = " "
2022-04-28 07:06:01 +02:00
if can_edit_evals and etat_txt :
2020-09-26 16:19:37 +02:00
etat_txt = (
' <a href= " evaluation_edit?evaluation_id= %s " title= " %s " > %s </a> '
% ( eval [ " evaluation_id " ] , etat_descr , etat_txt )
)
H . append ( etat_txt )
H . append ( """ </th></tr> """ )
H . append ( """ <tr class= " %s " ><td class= " mievr " > """ % tr_class )
2022-04-28 07:06:01 +02:00
if can_edit_evals :
2020-09-26 16:19:37 +02:00
H . append (
""" <a class= " smallbutton " href= " evaluation_edit?evaluation_id= %s " > %s </a> """
% (
eval [ " evaluation_id " ] ,
2021-01-17 22:31:28 +01:00
scu . icontag (
" edit_img " , alt = " modifier " , title = " Modifier informations "
) ,
2020-09-26 16:19:37 +02:00
)
)
2022-04-28 07:06:01 +02:00
if can_edit_notes :
2020-09-26 16:19:37 +02:00
H . append (
""" <a class= " smallbutton " href= " saisie_notes?evaluation_id= %s " > %s </a> """
% (
eval [ " evaluation_id " ] ,
2021-01-17 22:31:28 +01:00
scu . icontag (
" notes_img " , alt = " saisie notes " , title = " Saisie des notes "
) ,
2020-09-26 16:19:37 +02:00
)
)
if etat [ " nb_notes " ] == 0 :
2022-04-28 07:06:01 +02:00
if can_edit_evals :
2020-09-26 16:19:37 +02:00
H . append (
""" <a class= " smallbutton " href= " evaluation_delete?evaluation_id= %(evaluation_id)s " > """
% eval
)
2021-01-17 22:31:28 +01:00
H . append ( scu . icontag ( " delete_img " , alt = " supprimer " , title = " Supprimer " ) )
2022-04-28 07:06:01 +02:00
if can_edit_evals :
2020-09-26 16:19:37 +02:00
H . append ( """ </a> """ )
elif etat [ " evalcomplete " ] :
H . append (
""" <a class= " smallbutton " href= " evaluation_listenotes?evaluation_id= %s " > %s </a> """
2021-01-17 22:31:28 +01:00
% ( eval [ " evaluation_id " ] , scu . icontag ( " status_green_img " , title = " ok " ) )
2020-09-26 16:19:37 +02:00
)
else :
if etat [ " evalattente " ] :
H . append (
""" <a class= " smallbutton " href= " evaluation_listenotes?evaluation_id= %s " > %s </a> """
% (
eval [ " evaluation_id " ] ,
2021-01-17 22:31:28 +01:00
scu . icontag (
2020-09-26 16:19:37 +02:00
" status_greenorange_img " ,
file_format = " gif " ,
title = " notes en attente " ,
) ,
)
)
else :
H . append (
""" <a class= " smallbutton " href= " evaluation_listenotes?evaluation_id= %s " > %s </a> """
% (
eval [ " evaluation_id " ] ,
2021-01-17 22:31:28 +01:00
scu . icontag ( " status_orange_img " , title = " il manque des notes " ) ,
2020-09-26 16:19:37 +02:00
)
)
#
2021-08-11 00:36:07 +02:00
if eval [ " visibulletin " ] :
2020-09-26 16:19:37 +02:00
H . append (
2021-01-17 22:31:28 +01:00
scu . icontag (
2020-09-26 16:19:37 +02:00
" status_visible_img " , title = " visible dans bulletins intermédiaires "
)
)
else :
H . append ( " " )
H . append ( ' </td><td class= " mievr_menu " > ' )
2022-04-28 07:06:01 +02:00
if can_edit_notes :
2020-09-26 16:19:37 +02:00
H . append (
moduleimpl_evaluation_menu (
eval [ " evaluation_id " ] ,
nbnotes = etat [ " nb_notes " ] ,
)
)
H . append ( " </td> " )
#
H . append (
"""
< td class = " mievr_dur " > % s < / td > < td class = " rightcell mievr_coef " > % s < / td > """
% ( eval [ " duree " ] , " %g " % eval [ " coefficient " ] )
)
H . append (
""" <td class= " rightcell mievr_nbnotes " > %(nb_notes)s / %(nb_inscrits)s </td>
< td class = " rightcell mievr_coef " > % ( nb_abs ) s < / td >
< td class = " rightcell mievr_coef " > % ( nb_neutre ) s < / td >
< td class = " rightcell " > """
% etat
)
if etat [ " moy " ] :
2021-01-02 22:07:38 +01:00
H . append ( " <b> %s / %g </b> " % ( etat [ " moy " ] , eval [ " note_max " ] ) )
H . append (
""" (<a href= " evaluation_listenotes?evaluation_id= %s " >afficher</a>) """
% ( eval [ " evaluation_id " ] , )
)
2020-09-26 16:19:37 +02:00
else :
H . append (
""" <a class= " redlink " href= " saisie_notes?evaluation_id= %s " >saisir notes</a> """
% ( eval [ " evaluation_id " ] )
)
H . append ( """ </td></tr> """ )
#
if etat [ " nb_notes " ] == 0 :
2021-12-19 11:08:03 +01:00
H . append ( """ <tr class= " %s " ><td></td> """ % tr_class )
if modimpl . module . is_apc ( ) :
H . append (
f """ <td colspan= " 7 " class= " eval_poids " > {
evaluation . get_ue_poids_str ( ) } < / td > """
)
else :
H . append ( ' <td colspan= " 7 " ></td> ' )
H . append ( """ </tr> """ )
2020-09-26 16:19:37 +02:00
else : # il y a deja des notes saisies
gr_moyennes = etat [ " gr_moyennes " ]
2021-12-19 11:08:03 +01:00
first_group = True
2020-09-26 16:19:37 +02:00
for gr_moyenne in gr_moyennes :
H . append ( """ <tr class= " %s " > """ % tr_class )
2021-12-19 11:08:03 +01:00
H . append ( """ <td> </td> """ )
if first_group and modimpl . module . is_apc ( ) :
H . append (
f """ <td class= " eval_poids " colspan= " 3 " > {
evaluation . get_ue_poids_str ( ) } < / td > """
)
else :
H . append ( """ <td colspan= " 3 " ></td> """ )
first_group = False
2020-09-26 16:19:37 +02:00
if gr_moyenne [ " group_name " ] is None :
name = " Tous " # tous
else :
name = " Groupe %s " % gr_moyenne [ " group_name " ]
H . append (
2021-12-19 11:08:03 +01:00
""" <td colspan= " 3 " class= " mievr_grtit " > %s </td><td> """ % name
2020-09-26 16:19:37 +02:00
)
if gr_moyenne [ " gr_nb_notes " ] > 0 :
H . append ( " %(gr_moy)s " % gr_moyenne )
H . append (
2021-08-15 09:55:35 +02:00
""" (<a href= " evaluation_listenotes?tf_submitted=1&evaluation_id= %s &group_ids %% 3Alist= %s " > %s notes</a> """
2020-09-26 16:19:37 +02:00
% (
eval [ " evaluation_id " ] ,
gr_moyenne [ " group_id " ] ,
gr_moyenne [ " gr_nb_notes " ] ,
)
)
if gr_moyenne [ " gr_nb_att " ] > 0 :
H . append (
""" , <span class= " redboldtext " > %s en attente</span> """
% gr_moyenne [ " gr_nb_att " ]
)
H . append ( """ ) """ )
if gr_moyenne [ " group_id " ] in etat [ " gr_incomplets " ] :
H . append ( """ [<font color= " red " > """ )
2022-04-28 07:06:01 +02:00
if can_edit_notes :
2020-09-26 16:19:37 +02:00
H . append (
2021-05-11 11:48:32 +02:00
""" <a class= " redlink " href= " saisie_notes?evaluation_id= %s &group_ids:list= %s " >incomplet</a></font>] """
2020-09-26 16:19:37 +02:00
% ( eval [ " evaluation_id " ] , gr_moyenne [ " group_id " ] )
)
else :
H . append ( """ incomplet</font>] """ )
else :
H . append ( """ <span class= " redboldtext " > """ )
2022-04-28 07:06:01 +02:00
if can_edit_notes :
2020-09-26 16:19:37 +02:00
H . append (
2021-05-11 11:48:32 +02:00
""" <a class= " redlink " href= " saisie_notes?evaluation_id= %s &group_ids:list= %s " > """
2020-09-26 16:19:37 +02:00
% ( eval [ " evaluation_id " ] , gr_moyenne [ " group_id " ] )
)
H . append ( " pas de notes " )
2022-04-28 07:06:01 +02:00
if can_edit_notes :
2020-09-26 16:19:37 +02:00
H . append ( """ </a> """ )
H . append ( " </span> " )
H . append ( """ </td></tr> """ )
2021-12-19 11:08:03 +01:00
first_eval = False
2020-09-26 16:19:37 +02:00
#
2022-04-28 07:06:01 +02:00
H . append ( """ <tr><td colspan= " 8 " > """ )
if sem_locked :
H . append ( f """ { scu . icontag ( " lock32_img " ) } semestre verrouillé """ )
elif can_edit_evals :
H . append ( top_table_links )
2020-09-26 16:19:37 +02:00
H . append (
""" </td></tr>
< / table >
< / div >
< ! - - LEGENDE - - >
< hr >
< h4 > Légende < / h4 >
< ul >
< li > % s : modifie description de l ' évaluation (date, heure, coefficient, ...)</li>
< li > % s : saisie des notes < / li >
< li > % s : indique qu ' il n ' y a aucune note entrée ( cliquer pour supprimer cette évaluation ) < / li >
< li > % s : indique qu ' il manque quelques notes dans cette évaluation</li>
< li > % s : toutes les notes sont entrées ( cliquer pour les afficher ) < / li >
< li > % s : indique que cette évaluation sera mentionnée dans les bulletins au format " intermédiaire "
< / ul >
< p > Rappel : seules les notes des évaluations complètement saisies ( affichées en vert ) apparaissent dans les bulletins .
< / p >
"""
% (
2021-01-17 22:31:28 +01:00
scu . icontag ( " edit_img " ) ,
scu . icontag ( " notes_img " ) ,
scu . icontag ( " delete_img " ) ,
scu . icontag ( " status_orange_img " ) ,
scu . icontag ( " status_green_img " ) ,
scu . icontag ( " status_visible_img " ) ,
2020-09-26 16:19:37 +02:00
)
)
2021-07-29 10:19:00 +02:00
H . append ( html_sco_header . sco_footer ( ) )
2020-09-26 16:19:37 +02:00
return " " . join ( H )