<varlistentry>
<term>Nombre de lignes par pages dans la sélection de l'export Notanet</term>
<listitem>
- <programlisting>eliot.notes.notanet.selection.nombreLignesParPage = 25 </programlisting>
+ <programlisting>eliot.notes.notanet.selection.nombreLignesParPage = 25</programlisting>
</listitem>
</varlistentry>
<para>Si cette valeur est à 0, le job est arrêté.</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term>Délais de répétition du job d'export Notanet en ms</term>
<para>Si cette valeur est à 0, le job est arrêté.</para>
</listitem>
</varlistentry>
- <varlistentry>
+
+ <varlistentry>
+ <term>Démarrage du job du report des propriétés des services de la classe source vers les services des classes cibles en ms
+ </term>
+ <listitem>
+ <programlisting>eliot.notes.triggerNotesReportProprietes.startDelay = 1000</programlisting>
+ <para>Si cette valeur est à 0, le job est arrêté.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+
+ <term>Délais de répétition du job du report des propriétés des services de la classe source vers les services des classes cibles en ms</term>
+ <listitem>
+ <programlisting>eliot.notes.triggerNotesReportProprietes.repeatInterval = 60000</programlisting>
+ <para>Si cette valeur est à 0, le job est arrêté.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>Chemin de stockage des fichiers pour l'export Notanet
</term>
* @return String
* @author bper
*/
- protected String getTypePeriodeLibelle(TypePeriode typePeriode) {
+ String getTypePeriodeLibelle(TypePeriode typePeriode) {
if (typePeriode == null) {
return null
}
* @return String
* @author bper
*/
- protected String getTypePeriodeLibelleCourt(TypePeriode typePeriode) {
+ String getTypePeriodeLibelleCourt(TypePeriode typePeriode) {
if (typePeriode == null) {
return null
}
* @param naturePeriodeNom
* @return
*/
- protected String getNatureLibelle(String naturePeriodeNom) {
+ String getNatureLibelle(String naturePeriodeNom) {
return message(code: "eliot.libelle.nature.$naturePeriodeNom", default: naturePeriodeNom)
}
--- /dev/null
+package org.lilie.services.eliot.notes
+
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.scolarite.TypePeriode
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.Etablissement
+
+/**
+ * Report d'options des service d'une classe source aux services de classes cibles
+ */
+class Report {
+
+ Long id
+ Etablissement etablissement
+ StructureEnseignement classeSource
+ NaturePeriode naturePeriode
+ TypePeriode typePeriode
+ Boolean reportSousServices = Boolean.FALSE
+ Boolean reportOrdre = Boolean.FALSE
+ Boolean reportCoefficients = Boolean.FALSE
+ Set<ReportTraitement> reportTraitements
+
+ static constraints = {
+ etablissement (nullable: false)
+ classeSource (nullable: false)
+ naturePeriode (nullable: false)
+ typePeriode(nullable: true)
+ reportSousServices (nullable: false)
+ reportOrdre (nullable: false)
+ reportCoefficients (nullable: false)
+ }
+
+
+ static hasMany = [
+ reportTraitements: ReportTraitement
+ ]
+
+ static mapping = {
+ table('entnotes.report')
+ id column: 'id',
+ generator: 'sequence',
+ params: [sequence: 'entnotes.report_id_seq']
+ etablissement column: 'etablissement_id'
+ classeSource column: 'classe_source_id'
+ naturePeriode column: 'nature_periode'
+ typePeriode column: 'type_periode_id'
+ reportSousServices column: 'report_sous_services'
+ reportOrdre column: 'report_ordre'
+ reportCoefficients column: 'report_coefficients'
+
+ version false
+ }
+
+}
--- /dev/null
+package org.lilie.services.eliot.notes
+
+import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+
+/**
+ * Report d'options d'un service d'une classe source a service de classe cible
+ */
+class ReportTraitement {
+
+ Long id
+ Report report
+ StructureEnseignement classeCible
+ Service serviceCible
+ ReportTraitementEtat etat
+
+ static constraints = {
+ report (nullable: false)
+ classeCible(nullable: false)
+ serviceCible (nullable: false)
+ etat (nullable: false)
+ }
+
+ static mapping = {
+ table('entnotes.report_traitement')
+ id column: 'id',
+ generator: 'sequence',
+ params: [sequence: 'entnotes.report_traitement_id_seq']
+ report column: 'report_id'
+ classeCible column: 'classe_cible_id'
+ serviceCible column: 'service_cible_id'
+ etat column: 'etat'
+ version false
+ }
+
+ String toString() {
+ return "$serviceCible @ $classeCible [$etat]"
+ }
+
+}
--- /dev/null
+package org.lilie.services.eliot.notes
+
+/**
+ * Etat de traitement du report d'un service
+ * @author msan
+ */
+enum ReportTraitementEtat {
+ EN_ATTENTE,
+ EN_COURS,
+ TERMINE,
+ ERREUR
+
+ String getId() {
+ return this
+ }
+
+}
libelleCourt(nullable: false)
libelleEdition(nullable: false)
codeGestion(nullable: false, blank: false)
- etablissement(nullable: false)
origine(nullable: true)
libelleLong(nullable: false, blank: false)
etablissement(nullable: false)
String getId() {
return this
}
+
+ /**
+ * Recupere la nature de periode depuis son nom
+ * @param nomNature
+ * @return
+ */
+ static NaturePeriode parseNom(String nomNature) {
+ NaturePeriode naturePeriode = values().find {it.toString() == nomNature}
+ if (!naturePeriode) {
+ throw new IllegalArgumentException("Nature de periode inconnue: $nomNature")
+ }
+ return naturePeriode
+ }
}
\ No newline at end of file
]
String toString() {
- return "${id}"
+ return "$id ${matiere?.libelleLong} ${structureEnseignement?.code}"
}
static mapping = {
periode.trimestre.deuxieme.libelle.court=2\u00e8me T
periode.trimestre.troisieme.libelle.court=3\u00e8me T
periode.annee.libelle.court=Ann\u00e9e
+
+etat.libelle.EN_ATTENTE=En attente
+etat.libelle.EN_COURS=En cours
+etat.libelle.TERMINE=Termin\u00e9
+etat.libelle.ERREUR=Erreur
* @param libelle
* @return
*/
- private ModaliteMatiere internalCreeModaliteMatiere(Etablissement etablissement,
+ ModaliteMatiere internalCreeModaliteMatiere(Etablissement etablissement,
String code,
String libelle) {
import org.lilie.services.eliot.notes.StructureEnseignementNotes
import org.hibernate.transform.Transformers
import org.hibernate.criterion.CriteriaSpecification
+import org.lilie.services.eliot.scolarite.TypeIntervalleEnum
/**
* Service de gestion des structures d'enseignement pour l'annuaire local
StructureEnseignement creeStructureEnseignement(String code,
String type,
Etablissement etablissement,
- AnneeScolaire anneeScolaire) {
+ AnneeScolaire anneeScolaire,
+ TypeIntervalleEnum typeIntervalle = TypeIntervalleEnum.TRIMESTRE) {
// TOREFACT : Securiser + StructureEnseignementParam
// Crée les période de notation pour la structure d'enseignement
periodeService.creePeriodesNotationPourStructureEnseignement(
- structureEnseignement
+ structureEnseignement,
+ typeIntervalle
)
return structureEnseignement
datas.collect {
entry ->
- StructureEnseignement value = (StructureEnseignement) entry.getValue()
- classes << value
+ StructureEnseignement value = (StructureEnseignement) entry.getValue()
+ classes << value
}
return classes
if (ids) {
return StructureEnseignement.withCriteria {
'in'('id', ids)
+ fetchMode('structureEnseignementSts', FetchMode.JOIN)
+ fetchMode('structureEnseignementNotes', FetchMode.JOIN)
+ fetchMode('preferences', FetchMode.JOIN)
}
} else {
return []
import org.lilie.services.eliot.impression.SmsFournisseurEtablissement
import org.lilie.services.eliot.sms.SmsFournisseurService
import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.scolarite.ModaliteMatiere
+import org.lilie.services.eliot.scolarite.ModaliteMatiereService
/**
* Donnees pour les tests d'integrations automatique
LilieHttpService lilieHttpService
PreferenceEtablissementService preferenceEtablissementService
SmsFournisseurService smsFournisseurService
+ ModaliteMatiereService modaliteMatiereService
/**
* @param etab un établissement de la population de test
smsFournisseurEtablissement.save(flush: true, failOnError: true)
}
+ ModaliteMatiere getModaliteMatiere(PopulationTestModaliteMatiere populationTestModaliteMatiere) {
+
+ Etablissement etablissement = getEtablissement(populationTestModaliteMatiere.etablissement)
+
+ ModaliteMatiere modaliteMatiere = ModaliteMatiere.
+ findByEtablissementAndCode(
+ etablissement,
+ populationTestModaliteMatiere.code
+ )
+ if (!modaliteMatiere) {
+ modaliteMatiereService.internalCreeModaliteMatiere(
+ etablissement,
+ populationTestModaliteMatiere.code,
+ populationTestModaliteMatiere.libelle
+ )
+ }
+ return modaliteMatiere
+ }
}
* @author jtra
*/
public enum PopulationTestClasse implements PopulationTestStructureEnseignement {
- CLASSE_1(
- "2",
- "2NDE2",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- CLASSE_SANS_ELEVES(
- "0",
- "TEST",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- CLASSE_1_2(
- "1",
- "2NDE1",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- CLASSE_1_TES1(
- "27",
- "TES1",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- CLASSE_2(
- "8",
- "2NDE4",
- PopulationTestEtablissement.ETABLISSEMENT_2
- ),
- CLASSE_2_2(
- "38",
- "TES2",
- PopulationTestEtablissement.ETABLISSEMENT_2
- ),
- CLASSE_3("7",
- "1ES1",
- PopulationTestEtablissement.ETABLISSEMENT_2
- ),
- CLASSE_4_1("22",
- "2NDE11",
- PopulationTestEtablissement.ETABLISSEMENT_4
- ),
- CLASSE_4_2("10",
- "2NDE5",
- PopulationTestEtablissement.ETABLISSEMENT_4
- ),
- HORS_ANNUAIRE_CLASSE_1(
- "111",
- "TCLASSE1",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- HORS_ANNUAIRE_CLASSE_2(
- "222",
- "TCLASSE2",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- HORS_ANNUAIRE_CLASSE_3(
- "333",
- "TCLASSE3",
- PopulationTestEtablissement.ETABLISSEMENT_2
- ),
- CLASSE_5(
- "15",
- "2NDE5",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- CLASSE_6(
- "16",
- "2NDE6",
- PopulationTestEtablissement.ETABLISSEMENT_1
- ),
- CLASSE_1_ETAB_10(
- "200",
- "3EME5",
- PopulationTestEtablissement.ETABLISSEMENT_10
- ),
- CLASSE_2_ETAB_10(
- "201",
- "3EME6",
- PopulationTestEtablissement.ETABLISSEMENT_10
- ),
- CLASSE_3_ETAB_10(
- "202",
- "3EME7",
- PopulationTestEtablissement.ETABLISSEMENT_10
- ),
- CLASSE_4_ETAB_10(
- "204",
- "3EME8",
- PopulationTestEtablissement.ETABLISSEMENT_10
- ),
- CLASSE_5_ETAB_10(
- "205",
- "3EME9",
- PopulationTestEtablissement.ETABLISSEMENT_10
- ),
- CLASSE_1_ETAB_11(
- "203",
- "3EME5",
- PopulationTestEtablissement.ETABLISSEMENT_11
- );
+ CLASSE_1(
+ "2",
+ "2NDE2",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ CLASSE_SANS_ELEVES(
+ "0",
+ "TEST",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ CLASSE_1_2(
+ "1",
+ "2NDE1",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ CLASSE_1_TES1(
+ "27",
+ "TES1",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ CLASSE_2(
+ "8",
+ "2NDE4",
+ PopulationTestEtablissement.ETABLISSEMENT_2
+ ),
+ CLASSE_2_2(
+ "38",
+ "TES2",
+ PopulationTestEtablissement.ETABLISSEMENT_2
+ ),
+ CLASSE_3("7",
+ "1ES1",
+ PopulationTestEtablissement.ETABLISSEMENT_2
+ ),
+ CLASSE_4_1("22",
+ "2NDE11",
+ PopulationTestEtablissement.ETABLISSEMENT_4
+ ),
+ CLASSE_4_2("10",
+ "2NDE5",
+ PopulationTestEtablissement.ETABLISSEMENT_4
+ ),
+ HORS_ANNUAIRE_CLASSE_1(
+ "111",
+ "TCLASSE1",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ HORS_ANNUAIRE_CLASSE_2(
+ "222",
+ "TCLASSE2",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ HORS_ANNUAIRE_CLASSE_3(
+ "333",
+ "TCLASSE3",
+ PopulationTestEtablissement.ETABLISSEMENT_2
+ ),
+ CLASSE_5(
+ "15",
+ "2NDE5",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ CLASSE_6(
+ "16",
+ "2NDE6",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ CLASSE_X(
+ "116",
+ "XXXX1",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ CLASSE_1_ETAB_10(
+ "200",
+ "3EME5",
+ PopulationTestEtablissement.ETABLISSEMENT_10
+ ),
+ CLASSE_2_ETAB_10(
+ "201",
+ "3EME6",
+ PopulationTestEtablissement.ETABLISSEMENT_10
+ ),
+ CLASSE_3_ETAB_10(
+ "202",
+ "3EME7",
+ PopulationTestEtablissement.ETABLISSEMENT_10
+ ),
+ CLASSE_4_ETAB_10(
+ "204",
+ "3EME8",
+ PopulationTestEtablissement.ETABLISSEMENT_10
+ ),
+ CLASSE_5_ETAB_10(
+ "205",
+ "3EME9",
+ PopulationTestEtablissement.ETABLISSEMENT_10
+ ),
+ CLASSE_1_ETAB_11(
+ "203",
+ "3EME5",
+ PopulationTestEtablissement.ETABLISSEMENT_11
+ );
- private final String idExterne;
- private final String code;
- private final PopulationTestEtablissement etablissement;
+ private final String idExterne;
+ private final String code;
+ private final PopulationTestEtablissement etablissement;
- private PopulationTestClasse(String idExterne,
- String code,
- PopulationTestEtablissement etablissement) {
- this.idExterne = idExterne;
- this.code = code;
- this.etablissement = etablissement;
- }
+ private PopulationTestClasse(String idExterne,
+ String code,
+ PopulationTestEtablissement etablissement) {
+ this.idExterne = idExterne;
+ this.code = code;
+ this.etablissement = etablissement;
+ }
- public String getIdExterne() {
- return idExterne;
- }
+ public String getIdExterne() {
+ return idExterne;
+ }
- public String getCode() {
- return code;
- }
+ public String getCode() {
+ return code;
+ }
- public PopulationTestEtablissement getEtablissement() {
- return etablissement;
- }
+ public PopulationTestEtablissement getEtablissement() {
+ return etablissement;
+ }
}
* @author jtra
*/
public enum PopulationTestMatiere {
- FRANCAIS(
- "Français", // libelleLong
- "Français", // libelleCourt
- "Français", // libelleEdition
- "TEST_FRAN", // codeGestion
- PopulationTestEtablissement.ETABLISSEMENT_1,
- OrigineEnum.MANUEL
- ),
- ANGLAIS(
- "Anglais", // libelleLong
- "Anglais", // libelleCourt
- "Anglais", // libelleEdition
- "TEST_ANGL", // codeGestion
- PopulationTestEtablissement.ETABLISSEMENT_1,
- OrigineEnum.MANUEL
- ),
- MATH(
- "Math", // libelleLong
- "Math", // libelleCourt
- "Math", // libelleEdition
- "TEST_MATH", // codeGestion
- PopulationTestEtablissement.ETABLISSEMENT_1,
- OrigineEnum.MANUEL
- ),
- ANGLAIS_LV1_ETAB1(
- "ANGLAIS LV1",
- "ANGLAIS LV1",
- "ANGLAIS LV1",
- "AGL1",
- PopulationTestEtablissement.ETABLISSEMENT_1,
- OrigineEnum.AUTO
- ),
- MATHEMATIQUES_ETAB1(
- "MATHEMATIQUES",
- "MATHEMATIQUES",
- "MATHEMATIQUES",
- "MATHS",
- PopulationTestEtablissement.ETABLISSEMENT_1,
- OrigineEnum.AUTO
- ),
- MATHEMATIQUES_ETAB2(
- "MATHEMATIQUES",
- "MATHEMATIQUES",
- "MATHEMATIQUES",
- "MATHS",
- PopulationTestEtablissement.ETABLISSEMENT_2,
- OrigineEnum.AUTO
- ),
- MATHEMATIQUES_ETAB_10(
- "MATHEMATIQUES",
- "MATHEMATIQUES",
- "MATHEMATIQUES",
- "MATHS",
- PopulationTestEtablissement.ETABLISSEMENT_10,
- OrigineEnum.AUTO
- ),
- FRANCAIS_ETAB_10(
- "Français", // libelleLong
- "Français", // libelleCourt
- "Français", // libelleEdition
- "TEST_FRAN", // codeGestion
- PopulationTestEtablissement.ETABLISSEMENT_10,
- OrigineEnum.MANUEL
- ),
- FRANCAIS_ETAB_11(
- "Français", // libelleLong
- "Français", // libelleCourt
- "Français", // libelleEdition
- "TEST_FRAN", // codeGestion
- PopulationTestEtablissement.ETABLISSEMENT_11,
- OrigineEnum.MANUEL
- );
+ FRANCAIS(
+ "Français", // libelleLong
+ "Français", // libelleCourt
+ "Français", // libelleEdition
+ "TEST_FRAN", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ ANGLAIS(
+ "Anglais", // libelleLong
+ "Anglais", // libelleCourt
+ "Anglais", // libelleEdition
+ "TEST_ANGL", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ MATH(
+ "Math", // libelleLong
+ "Math", // libelleCourt
+ "Math", // libelleEdition
+ "TEST_MATH", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ PORTUGAIS(
+ "Portugais", // libelleLong
+ "Portugais", // libelleCourt
+ "Portugais", // libelleEdition
+ "TEST_Portugais", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ CHINOIS(
+ "Chinois", // libelleLong
+ "Chinois", // libelleCourt
+ "Chinois", // libelleEdition
+ "TEST_Chinois", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ BASQUE(
+ "Euskara", // libelleLong
+ "Euskara", // libelleCourt
+ "Euskara", // libelleEdition
+ "TEST_Euskara", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ OCCITAN(
+ "Occitan", // libelleLong
+ "Occitan", // libelleCourt
+ "Occitan", // libelleEdition
+ "TEST_Occitan", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ ALSACIEN(
+ "Elsaessisch", // libelleLong
+ "Elsaessisch", // libelleCourt
+ "Elsaessisch", // libelleEdition
+ "TEST_Elsaessisch", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ BRETON(
+ "Occitan", // libelleLong
+ "Occitan", // libelleCourt
+ "Occitan", // libelleEdition
+ "TEST_Occitan", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.MANUEL
+ ),
+ ANGLAIS_LV1_ETAB1(
+ "ANGLAIS LV1",
+ "ANGLAIS LV1",
+ "ANGLAIS LV1",
+ "AGL1",
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.AUTO
+ ),
+ MATHEMATIQUES_ETAB1(
+ "MATHEMATIQUES",
+ "MATHEMATIQUES",
+ "MATHEMATIQUES",
+ "MATHS",
+ PopulationTestEtablissement.ETABLISSEMENT_1,
+ OrigineEnum.AUTO
+ ),
+ MATHEMATIQUES_ETAB2(
+ "MATHEMATIQUES",
+ "MATHEMATIQUES",
+ "MATHEMATIQUES",
+ "MATHS",
+ PopulationTestEtablissement.ETABLISSEMENT_2,
+ OrigineEnum.AUTO
+ ),
+ MATHEMATIQUES_ETAB_10(
+ "MATHEMATIQUES",
+ "MATHEMATIQUES",
+ "MATHEMATIQUES",
+ "MATHS",
+ PopulationTestEtablissement.ETABLISSEMENT_10,
+ OrigineEnum.AUTO
+ ),
+ FRANCAIS_ETAB_10(
+ "Français", // libelleLong
+ "Français", // libelleCourt
+ "Français", // libelleEdition
+ "TEST_FRAN", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_10,
+ OrigineEnum.MANUEL
+ ),
+ FRANCAIS_ETAB_11(
+ "Français", // libelleLong
+ "Français", // libelleCourt
+ "Français", // libelleEdition
+ "TEST_FRAN", // codeGestion
+ PopulationTestEtablissement.ETABLISSEMENT_11,
+ OrigineEnum.MANUEL
+ );
- private final String libelleLong;
- private final String libelleCourt;
- private final String libelleEdition;
- private final String codeGestion;
- private final PopulationTestEtablissement etablissement;
- private final OrigineEnum origine;
+ private final String libelleLong;
+ private final String libelleCourt;
+ private final String libelleEdition;
+ private final String codeGestion;
+ private final PopulationTestEtablissement etablissement;
+ private final OrigineEnum origine;
- private PopulationTestMatiere(String libelleLong,
- String libelleCourt,
- String libelleEdition,
- String codeGestion,
- PopulationTestEtablissement etablissement,
- OrigineEnum origine) {
- this.libelleLong = libelleLong;
- this.libelleCourt = libelleCourt;
- this.libelleEdition = libelleEdition;
- this.codeGestion = codeGestion;
- this.etablissement = etablissement;
- this.origine = origine;
- }
+ private PopulationTestMatiere(String libelleLong,
+ String libelleCourt,
+ String libelleEdition,
+ String codeGestion,
+ PopulationTestEtablissement etablissement,
+ OrigineEnum origine) {
+ this.libelleLong = libelleLong;
+ this.libelleCourt = libelleCourt;
+ this.libelleEdition = libelleEdition;
+ this.codeGestion = codeGestion;
+ this.etablissement = etablissement;
+ this.origine = origine;
+ }
- public String getLibelleLong() {
- return libelleLong;
- }
+ public String getLibelleLong() {
+ return libelleLong;
+ }
- public String getLibelleCourt() {
- return libelleLong;
- }
+ public String getLibelleCourt() {
+ return libelleLong;
+ }
- public String getLibelleEdition() {
- return libelleLong;
- }
+ public String getLibelleEdition() {
+ return libelleLong;
+ }
- public String getCodeGestion() {
- return codeGestion;
- }
+ public String getCodeGestion() {
+ return codeGestion;
+ }
- public PopulationTestEtablissement getEtablissement() {
- return etablissement;
- }
+ public PopulationTestEtablissement getEtablissement() {
+ return etablissement;
+ }
- public OrigineEnum getOrigine() {
- return origine;
- }
+ public OrigineEnum getOrigine() {
+ return origine;
+ }
}
--- /dev/null
+package org.lilie.services.eliot.test;
+
+/**
+ * Définit les modalite matières à utiliser pour les tests
+ *
+ * @author jtra
+ */
+public enum PopulationTestModaliteMatiere {
+ ECRIT_ETAB1(
+ "Ecrit", // libelle
+ "Ecrit", // code
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ ),
+ ORAL_ETAB1(
+ "Oral",
+ "Oral",
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ );
+
+ private final String libelle;
+ private final String code;
+ private final PopulationTestEtablissement etablissement;
+
+ private PopulationTestModaliteMatiere(String libelle,
+ String code,
+ PopulationTestEtablissement etablissement) {
+ this.libelle = libelle;
+ this.code = code;
+ this.etablissement = etablissement;
+ }
+
+ public String getLibelle() {
+ return libelle;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public PopulationTestEtablissement getEtablissement() {
+ return etablissement;
+ }
+
+}
IMPRESSION_CDT(12, 'demande.traitement.type.impression.cdt'),
IMPRESSION_CDT_MULTIPLE(13, 'demande.traitement.type.impression.cdt'),
- NOTIFICATION(14, 'demande.traitement.type.notification')
+ NOTIFICATION(14, 'demande.traitement.type.notification'),
+
+ REPORT_OPTIONS_SERVICE(15, 'demande.traitement.type.report.options.service')
private final String codeMessage
private final int code
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ ~ This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ ~
+ ~ Lilie is free software. You can redistribute it and/or modify since
+ ~ you respect the terms of either (at least one of the both license) :
+ ~ - under the terms of the GNU Affero General Public License as
+ ~ published by the Free Software Foundation, either version 3 of the
+ ~ License, or (at your option) any later version.
+ ~ - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ ~ License, or any later version
+ ~
+ ~ There are special exceptions to the terms and conditions of the
+ ~ licenses as they are applied to this software. View the full text of
+ ~ the exception in file LICENSE.txt in the directory of this software
+ ~ distribution.
+ ~
+ ~ Lilie 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
+ ~ Licenses for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ and the CeCILL-C along with Lilie. If not, see :
+ ~ <http://www.gnu.org/licenses/> and
+ ~ <http://www.cecill.info/licences.fr.html>.
+ -->
+
+<databaseChangeLog
+ xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
+ <changeSet id="1" author="msan">
+
+ <comment>
+ Création du report
+ </comment>
+
+ <createSequence sequenceName="report_id_seq" schemaName="entnotes" />
+
+ <createTable tableName="report" schemaName="entnotes">
+ <column name="id" type="bigint">
+ <constraints primaryKey="true" primaryKeyName="pk_report" nullable="false" />
+ </column>
+ <column name="classe_source_id" type="bigint">
+ <constraints nullable="false"/>
+ </column>
+ <column name="nature_periode" type="varchar(20)" >
+ <constraints nullable="false"/>
+ </column>
+ <column name="type_periode_id" type="bigint">
+ <constraints nullable="true"/>
+ </column>
+ <column name="report_sous_services" type="boolean" defaultValueBoolean="false">
+ <constraints nullable="false"/>
+ </column>
+ <column name="report_ordre" type="boolean" defaultValueBoolean="false">
+ <constraints nullable="false"/>
+ </column>
+ <column name="report_coefficients" type="boolean" defaultValueBoolean="false">
+ <constraints nullable="false"/>
+ </column>
+ </createTable>
+
+ <addForeignKeyConstraint baseTableName="report"
+ baseColumnNames="classe_source_id"
+ baseTableSchemaName="entnotes"
+ constraintName="fk_report_structure_enseignement"
+ referencedTableName="structure_enseignement"
+ referencedColumnNames="id"
+ referencedTableSchemaName="ent"
+ onDelete="CASCADE"/>
+
+ <addForeignKeyConstraint baseTableName="report"
+ baseColumnNames="type_periode_id"
+ baseTableSchemaName="entnotes"
+ constraintName="fk_report_type_periode"
+ referencedTableName="type_periode"
+ referencedColumnNames="id"
+ referencedTableSchemaName="ent"
+ onDelete="CASCADE"/>
+
+ </changeSet>
+ <changeSet id="2" author="msan">
+
+ <comment>
+ Création du report_traitement
+ </comment>
+
+ <createSequence sequenceName="report_traitement_id_seq" schemaName="entnotes" />
+
+ <createTable tableName="report_traitement" schemaName="entnotes">
+ <column name="id" type="bigint">
+ <constraints primaryKey="true" primaryKeyName="pk_report_traitement" nullable="false" />
+ </column>
+ <column name="report_id" type="bigint">
+ <constraints nullable="false"/>
+ </column>
+ <column name="classe_cible_id" type="bigint">
+ <constraints nullable="false"/>
+ </column>
+ <column name="service_cible_id" type="bigint" >
+ <constraints nullable="false"/>
+ </column>
+ <column name="etat" type="varchar" defaultValue="EN_ATTENTE">
+ <constraints nullable="false"/>
+ </column>
+ </createTable>
+
+ <addForeignKeyConstraint baseTableName="report_traitement"
+ baseColumnNames="report_id"
+ baseTableSchemaName="entnotes"
+ constraintName="fk_report_traitement_report"
+ referencedTableName="report"
+ referencedColumnNames="id"
+ referencedTableSchemaName="entnotes"
+ onDelete="CASCADE"/>
+
+ <addForeignKeyConstraint baseTableName="report_traitement"
+ baseColumnNames="service_cible_id"
+ baseTableSchemaName="entnotes"
+ constraintName="fk_report_traitement_service"
+ referencedTableName="service"
+ referencedColumnNames="id"
+ referencedTableSchemaName="ent"
+ onDelete="CASCADE"/>
+
+ <addForeignKeyConstraint baseTableName="report_traitement"
+ baseColumnNames="classe_cible_id"
+ baseTableSchemaName="entnotes"
+ constraintName="fk_report_traitement_structure_enseignememt"
+ referencedTableName="structure_enseignement"
+ referencedColumnNames="id"
+ referencedTableSchemaName="ent"
+ onDelete="CASCADE"/>
+
+ <sql>
+ alter table entnotes.report_traitement
+ add constraint chk_report_traitement_etat
+ CHECK
+ (etat='EN_ATTENTE' or etat='EN_COURS' or etat='ERREUR' or
+ etat='TERMINE')
+ </sql>
+
+ </changeSet>
+ <changeSet id="3" author="msan">
+
+ <comment>
+ Ajout d'etablissement dans report
+ </comment>
+
+ <addColumn tableName="report" schemaName="entnotes">
+ <column name="etablissement_id" type="bigint">
+ <constraints nullable="false"/>
+ </column>
+ </addColumn>
+
+ <addForeignKeyConstraint baseTableName="report"
+ baseColumnNames="etablissement_id"
+ baseTableSchemaName="entnotes"
+ constraintName="fk_report_etablissement"
+ referencedTableName="etablissement"
+ referencedColumnNames="id"
+ referencedTableSchemaName="ent"
+ onDelete="CASCADE" />
+
+ <addUniqueConstraint tableName="report"
+ columnNames="etablissement_id"
+ constraintName="uk_report_etablissement_id"
+ schemaName="entnotes" />
+
+ </changeSet>
+
+</databaseChangeLog>
\ No newline at end of file
file="changelogs/scolarite/annuaire_interface/2013-04-23-0023926.xml"/>
<include
file="changelogs/scolarite/annuaire_interface/2013-04-24-0027499.xml"/>
+ <include file="changelogs/scolarite/2013-04-19-0026845.xml"/>
+
</databaseChangeLog>
eliot.notes.triggerNotesExportNotanet.startDelay = 1000
eliot.notes.triggerNotesExportNotanet.repeatInterval = 30 * 1000
+eliot.notes.triggerNotesReportProprietes.startDelay = 1000
+eliot.notes.triggerNotesReportProprietes.repeatInterval = 60 * 1000
+
+
// nombre maximum de colonnes dans l'état de synthèse (hors colonne élève et appréciation)
eliot.notes.synthese.largeur.max = 26
--- /dev/null
+package org.lilie.services.eliot.notes.domaine
+
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.TypePeriode
+
+/**
+ * Parametres de report des proprietes des services et sous-services
+ * @author msan
+ */
+class ReportParams {
+
+ StructureEnseignement classeSource
+ List<StructureEnseignement> classesCibles
+
+ Boolean ordreMatieres
+ Boolean coefficients
+ Boolean sousMatieres
+
+ NaturePeriode naturePeriode
+ TypePeriode typePeriode
+
+}
* <http://www.cecill.info/licences.fr.html>.
*/
-
-
-
-
package org.lilie.services.eliot.notes.domaine
import grails.converters.JSON
import org.lilie.services.eliot.scolarite.PeriodeService
import org.lilie.services.eliot.scolarite.TypePeriode
import org.lilie.services.eliot.notes.NotesFonction
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.notes.scolarite.NotesSousServiceService
+
/**
* La classe contient toutes les actions communes qui concernent à
NotesDroitService notesDroitService
NotesStructureEnseignementService notesStructureEnseignementService
PeriodeService periodeService
+ NotesSousServiceService notesSousServiceService
/**
* Retourne la liste des classe auxquelles l'utilisateur a l'accès
[
id: it.id,
code: it.code,
- typeIntervalle: it?.structureEnseignementNotes.typeIntervalle]
+ typeIntervalle: it?.structureEnseignementNotes?.typeIntervalle]
}]
}
TypePeriode typePeriode = TypePeriode.get(typePeriodeId)
List<StructureEnseignement> classes =
- notesStructureEnseignementService.internalFindAllClasse(typePeriode, etablissementCourant())
+ notesStructureEnseignementService.internalFindAllClasse(typePeriode, etablissementCourant())
classes.sort {a, b -> cc.compare(a.code, b.code)}
render result as JSON
}
+ def listeClassesParNaturePeriode = {
+ Map result = tryCatch {
+ notesDroitService.verifieAutorisationByEtablissement(
+ securiteSession,
+ etablissementCourant(),
+ Action.CONSULTATION,
+ NotesFonction.DIRECTION_ASSIMILE
+ )
+
+ String naturePeriodeStr = params.naturePeriode
+ if (naturePeriodeStr == null) {
+ throw new IllegalArgumentException('naturePeriode est null')
+ }
+ NaturePeriode naturePeriode = NaturePeriode.parseString(naturePeriodeStr)
+
+ String classeIdStr = params.classeId
+ if (classeIdStr == null) {
+ throw new IllegalArgumentException('classeId est null')
+ }
+ Long classeId = Long.parseLong(classeIdStr)
+
+ String typePeriodeIdStr = params.typePeriodeId
+ if (naturePeriode == NaturePeriode.EXAMEN && typePeriodeIdStr == null) {
+ throw new IllegalArgumentException('typePeriodeId est null')
+ }
+ TypePeriode typePeriode = typePeriodeIdStr ?
+ TypePeriode.get(typePeriodeIdStr) : null
+
+
+ List<StructureEnseignement> classes = notesStructureEnseignementService.
+ findAllClasseForEtablissementNatureTypePeriode(
+ securiteSession,
+ etablissementCourant(),
+ naturePeriode,
+ typePeriode)
+
+ classes.sort {a, b -> cc.compare(a.code, b.code)}
+
+ List classesList = classes.findAll { it.id != classeId }.collect {
+ [id: it.id, code: it.code]
+ }
+
+ return [classes: classesList]
+ }
+
+ render result as JSON
+ }
+
+
+
}
Fonctionnalite.PARAMETRAGES_PERIODES,
'parametragesPeriodes'
),
- PARAMETRAGES_ETABLISSEMENT(
- GroupePage.PARAMETRAGE,
- Fonctionnalite.PARAMETRAGES_ETABLISSEMENT,
- 'parametragesEtablissement'
- ),
PARAMETRAGES_GENERAUX(
GroupePage.PARAMETRAGE,
Fonctionnalite.PARAMETRAGES_GENERAUX,
+++ /dev/null
-/*
- * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
- * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
- *
- * Lilie is free software. You can redistribute it and/or modify since
- * you respect the terms of either (at least one of the both license) :
- * - under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- * - the CeCILL-C as published by CeCILL-C; either version 1 of the
- * License, or any later version
- *
- * There are special exceptions to the terms and conditions of the
- * licenses as they are applied to this software. View the full text of
- * the exception in file LICENSE.txt in the directory of this software
- * distribution.
- *
- * Lilie 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
- * Licenses for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the CeCILL-C along with Lilie. If not, see :
- * <http://www.gnu.org/licenses/> and
- * <http://www.cecill.info/licences.fr.html>.
- */
-
-
-
-package org.lilie.services.eliot.notes.parametrages
-
-import org.lilie.services.eliot.notes.page.Page
-import org.lilie.services.eliot.notes.AbstractNotesController
-import org.lilie.services.eliot.notes.NotesDroitService
-import org.lilie.services.eliot.droits.Action
-import org.lilie.services.eliot.notes.NotesFonction
-import org.lilie.services.eliot.urllabel.breadcrumbs.BreadCrumbsItemInfo
-
-/**
- * La classe représente le controlleur de la vue du 'Etablissement' dans menu
- * 'Paramétrage'
- * @author ywan
- * @author othe
- */
-class ParametragesEtablissementController extends AbstractNotesController {
-
- NotesDroitService notesDroitService
-
- def index = {
-
- notesDroitService.verifieAutorisationByEtablissement(
- securiteSession,
- etablissementCourant(),
- Action.CONSULTATION,
- NotesFonction.DIRECTION_ASSIMILE
- )
-
- render(view: '/parametrages/etablissement/index',
- model: prepareBaseModele(Page.PARAMETRAGES_ETABLISSEMENT)
- )
- }
-
- /**
- * Gestion du breadCrumbs
- * @return
- */
- protected List getBreadCrumbsInfo() {
- List breadCrumbsInfo = super.getBreadCrumbsInfo()
- breadCrumbsInfo << new BreadCrumbsItemInfo(
- codeLabel: 'notes.menu.parametrages.titrePrincipal'
- )
- breadCrumbsInfo << new BreadCrumbsItemInfo(
- codeLabel: 'notes.menu.parametrages.etablissement.titrePrincipal'
- )
-
- return breadCrumbsInfo
-
- }
-
-}
import org.lilie.services.eliot.notes.scolarite.NotesStructureEnseignementService
import org.lilie.services.eliot.notes.scolarite.NotesPeriodeService
import org.lilie.services.eliot.notes.domaine.ClassePeriodeInfo
-
+import org.lilie.services.eliot.scolarite.NaturePeriode
import org.lilie.services.eliot.scolarite.matiere.MatiereService
import org.lilie.services.eliot.scolarite.ModaliteMatiereService
import org.lilie.services.eliot.droits.Action
import org.lilie.services.eliot.annuaire.FonctionEnum
import org.lilie.services.eliot.notes.NotesFonction
import org.lilie.services.eliot.urllabel.breadcrumbs.BreadCrumbsItemInfo
-import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.notes.report.ReportProprietesService
+
+import grails.converters.JSON
+import org.lilie.services.eliot.scolarite.TypePeriode
+import org.lilie.services.eliot.notes.domaine.ReportParams
+import org.lilie.services.eliot.notes.report.ReportProprietes
+import org.lilie.services.eliot.urllabel.UrlLabelInfo
+import org.lilie.services.eliot.notes.report.ReportTraitementService
+import org.lilie.services.eliot.notes.report.ReportService
/**
* Cette classe représente le controlleur de la vue de "Services" dans menu
MatiereService matiereService
ModaliteMatiereService modaliteMatiereService
LocalPersonneService localPersonneService
+ ReportProprietesMarchallerService reportProprietesMarchallerService
+ ReportProprietesService reportProprietesService
+ ReportTraitementService reportTraitementService
+ ReportService reportService
/**
* @author mjao
}
}
+
+ // quand on revient de la page de suivi de traitements il faut
+ // afficher le typePeriode de quel on a lance le popup d'Appliquer a
+ if (params.typePeriodeId) {
+ Long typePeriodeAvantAppliquerAId = Long.parseLong(params.typePeriodeId)
+ Periode periodeChoisieAvantAppliquerA =
+ periodesEx.find {it.typePeriode.id == typePeriodeAvantAppliquerAId}
+ if (periodeChoisieAvantAppliquerA) {
+ periodeExamenEnCours =
+ creeClassePeriodeInfo(periodeChoisieAvantAppliquerA)
+ }
+ }
+
// si aucune période examen en cours, prends la première
if (!periodeExamenEnCours) {
periodeExamenEnCours = creeClassePeriodeInfo(periodesEx.first())
model['enseignants'] = enseignants
model['structures'] = structures
+ ReportProprietes reportProprietes =
+ reportTraitementService.findTraitementsEnCours(etablissementCourant())
+ model['traitementEnCours'] =
+ reportProprietesMarchallerService.marchalleReportProprietes(
+ reportProprietes,
+ this
+ ) as JSON
+
+ if (reportProprietes) {
+ model['breadCrumbsInfo'] = construisBreadCrumbsTraitementEnCours()
+ }
+
render(view: '/parametrages/services/index', model: model)
}
return breadCrumbsInfo
}
-
+
+ /**
+ * Construis le fil d'Ariane specifique pour le cas ou le traitement est en cours
+ * @return
+ */
+ private List construisBreadCrumbsTraitementEnCours() {
+ List<UrlLabelInfo> listeBreadCrumbsInfos = getBreadCrumbsInfo()
+ listeBreadCrumbsInfos << new BreadCrumbsItemInfo(
+ codeLabel: 'notes.menu.parametrages.services.suiviDesTraitements.titrePrincipal'
+ )
+ encodeToutesLesUrl(listeBreadCrumbsInfos)
+ return listeBreadCrumbsInfos
+ }
+
+
+ /**
+ * Report les proprietes des services evaluables de la classe source
+ * aux classes cibles
+ */
+ def lanceReport = {
+ Map result = tryCatch {
+ notesDroitService.verifieAutorisationByEtablissement(
+ securiteSession,
+ etablissementCourant(),
+ Action.MODIFICATION,
+ NotesFonction.DIRECTION_ASSIMILE
+ )
+
+ if (params.ordreMatieres == null) {
+ throw new IllegalArgumentException('ordreMatieres est null')
+ }
+ Boolean ordreMatieres = Boolean.valueOf(params.ordreMatieres)
+ if (params.ordreMatieres == null) {
+ throw new IllegalArgumentException('coefficients est null')
+ }
+ Boolean coefficients = Boolean.valueOf(params.coefficients)
+ if (params.sousMatieres == null) {
+ throw new IllegalArgumentException('sousMatieres est null')
+ }
+ Boolean sousMatieres = Boolean.valueOf(params.sousMatieres)
+ if (params.classeId == null) {
+ throw new IllegalArgumentException('classeId est null')
+ }
+ StructureEnseignement classeSource = notesStructureEnseignementService.
+ getClasseAvecExtensions(Long.valueOf(params.classeId))
+ if (params.naturePariode == null) {
+ throw new IllegalArgumentException('naturePariode est null')
+ }
+ NaturePeriode naturePeriode = NaturePeriode.parseString(params.naturePariode)
+ String typePeriodeIdStr = params.typePeriodeId
+ if (naturePeriode == NaturePeriode.EXAMEN && typePeriodeIdStr == null) {
+ throw new IllegalArgumentException('typePeriodeId est null')
+ }
+ TypePeriode typePeriode = typePeriodeIdStr ?
+ TypePeriode.get(typePeriodeIdStr) : null
+
+ List<StructureEnseignement> classesCibles =
+ notesStructureEnseignementService.findAllStructureForAllIds(
+ JSON.parse(params.classes).collect { (Long) it}
+ )
+
+ reportProprietesService.creeDemandeReport(
+ securiteSession.defaultAutorite,
+ etablissementCourant(),
+ new ReportParams(
+ sousMatieres: sousMatieres,
+ coefficients: coefficients,
+ ordreMatieres: ordreMatieres,
+ classeSource: classeSource,
+ classesCibles: classesCibles,
+ naturePeriode: naturePeriode,
+ typePeriode: typePeriode
+ )
+ )
+ }
+
+ render result as JSON
+ }
+
+ /**
+ * Valide le fait que le report des proprietes a termine
+ */
+ def valideReport = {
+ Map result = tryCatch {
+ // le report est termine - on peut enlever les info sur les etapes
+ reportService.supprimeReport(etablissementCourant())
+ }
+ render result as JSON
+ }
+
+ /**
+ * Interromps le report des proprietes
+ */
+ def interrompsReport = {
+ Map result = tryCatch {
+ reportTraitementService.supprimeReportsTraitementEnAttente(etablissementCourant())
+ }
+ render result as JSON
+ }
+
}
--- /dev/null
+package org.lilie.services.eliot.notes.parametrages
+
+import org.lilie.services.eliot.notes.report.ReportProprietes
+import org.lilie.services.eliot.notes.AbstractNotesController
+
+import org.lilie.services.eliot.notes.ReportTraitement
+import org.lilie.services.eliot.notes.ReportTraitementEtat
+
+/**
+ * @author msan
+ */
+class ReportProprietesMarchallerService {
+
+ static transactional = false
+
+ Map marchalleReportProprietes(ReportProprietes reportProprietes,
+ AbstractNotesController controller) {
+ if (reportProprietes == null) {
+ return [:]
+ }
+ return [
+
+ 'classeSourceId': reportProprietes.classeSource.id,
+ 'naturePeriodeId': reportProprietes.naturePeriode.id,
+ 'typePeriodeId':reportProprietes.typePriodeSource?.id,
+
+ 'classeSource': reportProprietes.classeSource.code,
+ 'naturePeriode': controller.getNatureLibelle(
+ reportProprietes.naturePeriode.name()),
+ 'typePeriode': reportProprietes.typePriodeSource?.libelle,
+
+ 'traitements': reportProprietes.traitementsReport.collect {
+ marchalleTraitementReport(it, controller)
+ }
+ ]
+ }
+
+ Map marchalleTraitementReport(ReportTraitement traitement,
+ AbstractNotesController controller) {
+ String libelleMatiere = traitement.serviceCible.matiere.codeGestion
+ if (traitement.serviceCible.structureEnseignement.isGroupe()) {
+ libelleMatiere = libelleMatiere+
+ " (${traitement.serviceCible.structureEnseignement.code})"
+ }
+
+ return [
+ 'structure': traitement.classeCible.code,
+ 'matiere': libelleMatiere,
+ 'etat': traitement.etat.name(),
+ 'etatLibelle': traitement.etat == ReportTraitementEtat.EN_ATTENTE ?
+ '' :
+ controller.message(
+ code: "etat.libelle.${traitement.etat}".toString(),
+ default: traitement.etat.name()
+ )
+ ]
+ }
+}
################## eliot-notes v1 refonte #############
filAriane.accueil=Notes de l'établissement
-notes.menu.parametrages.titreNotes
notes.menu.parametrages.titrePrincipal=Paramétrages
notes.menu.parametrages.services.titrePrincipal=Services
+notes.menu.parametrages.services.suiviDesTraitements.titrePrincipal=Suivi des traitements
notes.menu.parametrages.periodes.titrePrincipal=Périodes
-notes.menu.parametrages.etablissement.titrePrincipal=Etablissement
notes.menu.parametrages.generaux.titrePrincipal=Généraux
notes.menu.parametrages.brevet.titrePrincipal=Brevet
notes.menu.saisie.titrePrincipal=Saisie
notes.menu.publipostage.selection.titrePrincipal=Sélection
notes.menu.publipostage.suiviParEleve.titrePrincipal=Suivi par élève
notes.menu.publipostage.suiviImpression.titrePrincipal=Suivi des impressions
+notes.menu.export.titrePrincipal=Export
+notes.menu.export.admissionPostBac.titrePrincipal=Export vers Admission Post-Bac
+notes.menu.export.notanet.titrePrincipal=Export vers Notanet
+# Liste des etablissements d'utilisateur
+notes.menu.etablissement.titrePrincipal=Etablissement
+
notes.publipostage.message.ajout.succes=La demande d'impression a été ajoutée avec succès.
notes.publipostage.message.ajout.succes.titre=Confirmation
notes.publipostage.message.ajout.erreur=Une erreur s'est produite lors de l'enregistrement de la demande d'impression.
notes.publipostage.message.ajout.erreur.titre=Erreur
-notes.menu.etablissements.titrePrincipal=Etablissements
-notes.menu.export.titrePrincipal=Export
-notes.menu.export.admissionPostBac.titrePrincipal=Export vers Admission Post-Bac
-notes.menu.export.notanet.titrePrincipal=Export vers Notanet
#######################################################
notes.parametrage.tableservice.serviceExisteDeja.pl=Un service avec ces enseignants, cette matière et cette classe (ou ce groupe) existe déjà.
notes.parametrage.tableservice.group.servicesEvaluables=Services évaluables
notes.parametrage.tableservice.group.servicesNonEvaluables=Services non évaluables
+notes.parametrage.tableservice.interrompre=Interrompre
+notes.parametrage.tableservice.actualiser=Actualiser
+notes.parametrage.tableservice.classe=Classe
+notes.parametrage.tableservice.statut=Statut
+notes.parametrage.tableservice.traitementEnCoursMsg=Application de paramètres de services en cours
+notes.parametrage.tableservice.finTraitementMsg=Application de paramétrages de services terminé. Cliquez sur Valider.
## Messages flash du serveur
################ Parametrage des conseils ######################
eliot.notes.libelle.appliquerA=Appliquer à
eliot.notes.libelle.reportDuParametrage=Appliquer à
+eliot.notes.message.avertissement.appliquerA=La fonction de paramétrages des services sera momentanément indisponible durant le traitement.<br>Elle vous permettra d'accéder au suivi de l'application de vos paramétrages.
eliot.notes.libelle.ok=Ok
eliot.notes.libelle.oui=Oui
eliot.notes.parametrages.generaux.messages.supprimerAvis=Supprimer l'avis
eliot.notes.parametrages.generaux.messages.confirmeSupprimeAvis=Confirmez-vous la suppression de l'avis
+eliot.notes.parametrages.service.libelle.selectionParams=Sélection des paramétrages des matières communes à appliquer.
+eliot.notes.parametrages.service.libelle.paramAppliqueA=Paramétrages à appliquer:
+eliot.notes.parametrages.service.libelle.classesAModifier=Classes à modifier:
+eliot.notes.parametrages.service.message.enCoursAppliqueA=Application du paramétrage en cours.
+eliot.notes.parametrages.service.message.confirmationAppliqueA=Le paramétrage a été appliqué avec succès.
+eliot.notes.parametrages.service.message.erreurAppliqueA=Le paramétrage a échoué.
+eliot.notes.parametrages.service.libelle.ordreMatieres=Ordre des matières
+eliot.notes.parametrages.service.libelle.coefficients=Coefficients
+eliot.notes.parametrages.service.libelle.sousMatieres=Sous-matières
\ No newline at end of file
--- /dev/null
+package org.lilie.services.eliot.notes
+
+import org.codehaus.groovy.grails.commons.ConfigurationHolder
+import org.lilie.services.eliot.demon.DemandeTraitementService
+import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
+import org.lilie.services.eliot.notes.report.ReportProprietesService
+
+/**
+ * Report de proprietes des services d'une classe aux autres
+ */
+class ReportProprietesServiceJob {
+
+ def concurrent = false
+
+ private static final Integer DEFAULT_START_DELAY = 3 * 1000
+ private static final Integer DEFAULT_REPEAT_INTERVAL = 5 * 1000
+
+ DemandeTraitementService demandeTraitementService
+ ReportProprietesService reportProprietesService
+ LocalStructureEnseignementService localStructureEnseignementService
+
+ static triggers = {
+ Integer startDelayValue = ConfigurationHolder.config.eliot.notes.triggerNotesReportProprietes.startDelay
+ if (startDelayValue == 0) {
+ return
+ }
+ else if (!startDelayValue) {
+ startDelayValue = DEFAULT_START_DELAY
+ }
+
+ Integer repeatIntervalValue = ConfigurationHolder.config.eliot.notes.triggerNotesReportProprietes.repeatInterval
+ if (repeatIntervalValue == 0) {
+ return
+ }
+ else if (!repeatIntervalValue) {
+ repeatIntervalValue = DEFAULT_REPEAT_INTERVAL
+ }
+
+ // Job désactivé en mode maintenance
+ if (ConfigurationHolder.config.eliot.mode.maintenance) {return}
+
+ simple name: 'triggerNotesReportProprietes',
+ startDelay: startDelayValue,
+ repeatInterval: repeatIntervalValue
+ }
+
+ @SuppressWarnings('CatchException')
+ def execute() {
+ reportProprietesService.lanceReportDeProprietes()
+ }
+
+}
CONSULTATION_APPRECIATION_CLASSE,
PARAMETRAGES_SERVICES,
PARAMETRAGES_PERIODES,
- PARAMETRAGES_ETABLISSEMENT, // Cela parrait de ne pas etre utilise
PARAMETRAGES_GENERAUX,
PARAMETRAGES_BREVET,
IMPRESSION_BULLETIN,
getMenuInfoConsultation(menuConsultationVisible, pageCourante, menuInfo, fonctionnalitesAccessibles)
// --------- Parametrages
- // TOCHECK: Fonctionnalite.PARAMETRAGES_ETABLISSEMENT cette page est-elle utilisee ?
boolean menuParametragesVisible =
fonctionnalitesAccessibles.contains(Fonctionnalite.PARAMETRAGES_BREVET) ||
fonctionnalitesAccessibles.contains(Fonctionnalite.PARAMETRAGES_GENERAUX) ||
MenuItemInfo menuEtab = new EtablissementMenuItemInfo(
securiteSession,
Etablissement.get(etablissementId),
- 'notes.menu.parametrages.etablissement.titrePrincipal',
+ 'notes.menu.etablissement.titrePrincipal',
pageCourante)
if (!menuEtab.isEmpty()) {
--- /dev/null
+package org.lilie.services.eliot.notes.report
+
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.TypePeriode
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.notes.ReportTraitement
+
+/**
+ * L'information sur le traitement de report des options de service en cours
+ * @author msan
+ */
+class ReportProprietes {
+ StructureEnseignement classeSource
+ NaturePeriode naturePeriode
+ TypePeriode typePriodeSource
+ List<ReportTraitement> traitementsReport // traitements par service
+}
--- /dev/null
+package org.lilie.services.eliot.notes.report
+
+import org.lilie.services.eliot.annuaire.SecuriteSession
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.scolarite.TypePeriode
+import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.scolarite.SousService
+import org.lilie.services.eliot.scolarite.ModaliteMatiere
+import org.lilie.services.eliot.notes.domaine.ReportParams
+import org.lilie.services.eliot.scolarite.RelPeriodeService
+import org.lilie.services.eliot.scolarite.TypeIntervalleEnum
+import org.lilie.services.eliot.scolarite.IntervalleEnum
+import org.lilie.services.eliot.notes.resultat.UptodateService
+import org.lilie.services.eliot.notes.scolarite.NotesServiceService
+import org.lilie.services.eliot.notes.scolarite.NotesSousServiceService
+import org.lilie.services.eliot.notes.scolarite.NotesRelPeriodeServiceService
+import org.lilie.services.eliot.notes.scolarite.ModifieRelPeriodeServiceResultat
+import org.lilie.services.eliot.notes.scolarite.NotesPeriodeParams
+import org.lilie.services.eliot.notes.scolarite.NotesModaliteMatiereParams
+import org.lilie.services.eliot.scolarite.Etablissement
+import org.lilie.services.eliot.scolarite.anneescolaire.AnneeScolaireService
+import org.lilie.services.eliot.securite.Autorite
+import org.lilie.services.eliot.notes.ReportTraitement
+import org.hibernate.SessionFactory
+import org.lilie.services.eliot.notes.Report
+import org.lilie.services.eliot.notes.ReportTraitementEtat
+import org.lilie.services.eliot.securite.impl.DefaultSecuriteSessionFactory
+import org.hibernate.criterion.CriteriaSpecification
+
+/**
+ * Service de reportage des proprietes de services
+ * @author msan
+ */
+class ReportProprietesService {
+
+ NotesServiceService notesServiceService
+ NotesSousServiceService notesSousServiceService
+ NotesRelPeriodeServiceService notesRelPeriodeServiceService
+ UptodateService uptodateService
+ ReportTraitementService reportTraitementService
+ AnneeScolaireService anneeScolaireService
+ SessionFactory sessionFactory
+ ReportService reportService
+
+ static transactional = false // les transactions doivent etre au niveau "service de classe"
+
+ /**
+ * Effectue le report des proprietes des services de la classe source
+ * vers les services des classes cibles.
+ */
+ void lanceReportDeProprietes() {
+
+ List<ReportTraitement> allReportTraitementForClasse =
+ findAllReportTraitementGroupeParClasseCible()
+
+ if (allReportTraitementForClasse.isEmpty()) {
+ log.debug('Aucun service a traiter')
+ return // rien a traiter
+ }
+ Report report = allReportTraitementForClasse.first().report
+
+ List<Service> servicesSource = ordonneEtFiltreServices(
+ report.classeSource,
+ report.naturePeriode,
+ report.typePeriode
+ )
+
+ SecuriteSession securiteSession =
+ DefaultSecuriteSessionFactory.getEliotNotesSecuriteSessionForCodePorteurENT(
+ report.classeSource.etablissement.porteurEnt.code)
+
+ while (allReportTraitementForClasse) {
+ List<ReportServiceCorrespondance> allReportServiceCorrespondence =
+ calculeReportServiceCorrespondences(
+ allReportTraitementForClasse,
+ servicesSource
+ )
+
+ traiteTraitementsUneClasse(securiteSession, allReportServiceCorrespondence)
+
+ allReportTraitementForClasse = findAllReportTraitementGroupeParClasseCible()
+ }
+ }
+
+ /**
+ * Traite les reports des proprietes des services d'une classe
+ * @param securiteSession
+ * @param reportServiceCorrespondances
+ */
+ void traiteTraitementsUneClasse(SecuriteSession securiteSession,
+ List<ReportServiceCorrespondance> allReportServiceCorrespondence) {
+
+ allReportServiceCorrespondence.sort { it.serviceCibleOrdre }
+// allReportServiceCorrespondence.each {
+// println("ordreCible: [${it.serviceCibleOrdre}] serviceCible: "+
+// "[${it.reportTraitement.serviceCible}] serviceSource: [${it.serviceSource}]")
+// }
+
+ allReportServiceCorrespondence.each { ReportServiceCorrespondance reportServiceCorrespondance ->
+
+ ReportTraitement reportTraitementOriginal =
+ ReportTraitement.findById(reportServiceCorrespondance.reportTraitement.id)
+
+ if (!reportTraitementOriginal) {
+ log.info("ReportTraitement pas trouve pour classe cible: "+
+ "${reportServiceCorrespondance.reportTraitement.classeCible} "+
+ "service cible: ${reportServiceCorrespondance.reportTraitement.serviceCible}"+
+ ". Cela indique que le traitement de report a ete interrompu. "+
+ "Ce service ne vas pas etre traite.")
+ return
+ }
+
+ reportTraitementService.marqueDebutTraitement(reportTraitementOriginal)
+
+ try {
+ ReportTraitement.withNewSession {
+ ReportTraitement.withTransaction {
+
+ // attachement des objets a la nouvelle session
+ ReportServiceCorrespondance reportServiceCorrespondanceNewSession =
+ rattacheCorrespondenceANouvelleSession(reportServiceCorrespondance)
+
+ ReportTraitement reportTraitement =
+ reportServiceCorrespondanceNewSession.reportTraitement
+
+ Report report = reportTraitement.report
+
+ if (reportServiceCorrespondanceNewSession.serviceSource) {
+
+ // 1) traitement des sous-matieres
+ if (report.reportSousServices) {
+ reporteSousServicesAuService(
+ securiteSession,
+ reportServiceCorrespondanceNewSession.serviceSource,
+ reportTraitement.serviceCible,
+ report.naturePeriode,
+ report.typePeriode
+ )
+ }
+
+ // 2) traitement des ordres et coeffs
+ if (report.reportCoefficients || report.reportOrdre) {
+ reporteOrdreCoefficientsAuService(
+ securiteSession,
+ reportServiceCorrespondanceNewSession
+ )
+ }
+
+ }
+ }
+ }
+ reportTraitementService.marqueFinTraitement(reportTraitementOriginal)
+
+ } catch (Exception e) {
+ e.printStackTrace()
+ ReportTraitement reportTraitement = ReportTraitement.
+ findById(reportTraitementOriginal.id)
+ log.error("Erreur pendant le report des proprietes de service "+
+ "${reportTraitement.serviceCible}", e)
+ reportTraitementService.marqueErreurTraitement(reportTraitement)
+ }
+ }
+ }
+
+ /**
+ * Cherche les reports traitmements d'une classe cible.
+ * Les classes actuellement prises par le calcul des moyennes sont ignorees.
+ * @return
+ */
+ private List<ReportTraitement> findAllReportTraitementGroupeParClasseCible() {
+
+ // il faut que la variable s'appele differement qu'une propriete domaine
+ StructureEnseignement classeCibleX =
+ (StructureEnseignement) ReportTraitement.createCriteria().get {
+ eq('etat', ReportTraitementEtat.EN_ATTENTE)
+
+ createAlias('classeCible','classe')
+ createAlias(
+ 'classe.infoCalculMoyennesClasses',
+ 'infoCalcul',
+ CriteriaSpecification.LEFT_JOIN
+ )
+
+ or {
+ isEmpty('classe.infoCalculMoyennesClasses')
+ eq('infoCalcul.calculEnCours', false)
+ }
+
+ projections {
+ groupProperty('classeCible')
+ }
+
+ maxResults(1)
+ }
+
+ if (!classeCibleX) {
+ return []
+ }
+
+ return ReportTraitement.createCriteria().list {
+ eq('classeCible', classeCibleX)
+ eq('etat', ReportTraitementEtat.EN_ATTENTE)
+ }
+ }
+
+ /**
+ * Rattache reportServiceCorrespondence a la nouvelle session
+ * @param reportServiceCorrespondance
+ * @return
+ */
+ ReportServiceCorrespondance rattacheCorrespondenceANouvelleSession(ReportServiceCorrespondance reportServiceCorrespondance) {
+ ReportServiceCorrespondance reportNewSession = new ReportServiceCorrespondance(
+ reportTraitement: ReportTraitement.
+ findById(reportServiceCorrespondance.reportTraitement.id),
+ serviceSource: reportServiceCorrespondance.serviceSource ?
+ Service.findById(reportServiceCorrespondance.serviceSource.id) :
+ null,
+ serviceCibleOrdre: reportServiceCorrespondance.serviceCibleOrdre
+ )
+ return reportNewSession
+ }
+
+ /**
+ * Cherche les correspondences de services (souce - cible) et calcule
+ * les nouvels ordres
+ * @param reportTraitements
+ * @param servicesSource services de la clase source deja tries par l'ordre!
+ * @return
+ */
+ private List<ReportServiceCorrespondance> calculeReportServiceCorrespondences(List<ReportTraitement> reportTraitements,
+ List<Service> servicesSource) {
+ List<ReportServiceCorrespondance> reportServiceCorrespondences = []
+ if (reportTraitements.isEmpty()) {
+ return []
+ }
+
+ reportServiceCorrespondences = reportTraitements.collect {
+ new ReportServiceCorrespondance(
+ reportTraitement: it
+ )
+ }
+
+ List<Service> servicesCible = reportTraitements.collect {it.serviceCible}
+
+ // Cherche les services correspondents source <-> cible
+ List<Service> servicesEnPlus = []
+ List<Service> servicesCommuns = []
+ servicesCible.each { Service serviceCible ->
+ Service serviceSource =
+ chercheServiceSourceCorrespondant(serviceCible, servicesSource)
+ if (serviceSource) {
+ servicesCommuns.add(serviceCible)
+ } else {
+ servicesEnPlus.add(serviceCible)
+ }
+ reportServiceCorrespondences.
+ find { it.reportTraitement.serviceCible.id == serviceCible.id }.
+ serviceSource = serviceSource
+ }
+
+ // Calcul les ordres
+ Integer nouvelOrdre = 1
+ // services de la classe source sont deja tries par l'ordre!
+ servicesSource.each { Service serviceSource ->
+ List<ReportServiceCorrespondance> servicesCiblesCommuns =
+ reportServiceCorrespondences.findAll {
+ it.serviceSource == serviceSource
+ }
+ servicesCiblesCommuns.each { ReportServiceCorrespondance reportServiceCorrespondence ->
+ reportServiceCorrespondence.serviceCibleOrdre = nouvelOrdre++
+ }
+ }
+
+ reportServiceCorrespondences.each {
+ if (it.serviceCibleOrdre == null) {
+ it.serviceCibleOrdre = nouvelOrdre++
+ }
+ }
+
+ return reportServiceCorrespondences
+ }
+
+ /**
+ * Cherche le service correspondant la meme facon comme on le fait dans NotaBene
+ * @param serviceCible
+ * @param servicesSource
+ * @return
+ */
+ Service chercheServiceSourceCorrespondant(Service serviceCible,
+ List<Service> servicesSource) {
+ /*
+ On prend la matière du service de la classe de destination.
+ On compare la matière avec celles des services de la classe de référence.
+
+ => Cas 1 : matière trouvée avec un seul service dans la classe de référence
+ => on applique les paramètres du service de la classe de référence
+ au service de la classe de destination.
+ => Cas 2 : matière trouvée avec plusieurs services dans la classe de référence
+ => on recherche le service dans la classe de référence avec le même
+ professeur que celui de la classe de destination.
+ => Cas 1 : on ne trouve pas le service matière + prof dans la
+ classe de référence => aucun traitement.
+ => Cas 2 : on trouve le service matière + prof => on applique
+ les paramètres du service de la classe de référence
+ au service de la classe de destination.
+ => Cas 3 : matière non trouvée => aucun traitement.
+
+ - Pour les services avec plusieurs professeurs, on tient compte uniquement
+ du 1er professeur trouvé, que ce soit pour la classe de référence
+ ou de destination.
+
+ - On ne tient pas compte de l'information service classe ou groupe.
+
+ */
+
+ List<Service> servicesSourceMatiere =
+ servicesSource.findAll { it.matiere == serviceCible.matiere }
+
+ if (servicesSourceMatiere.isEmpty()) {
+ return null // cas 3
+ }
+
+ if (servicesSourceMatiere.size() == 1) {
+ return servicesSourceMatiere.first() // cas 1
+ }
+
+ return servicesSourceMatiere.find {
+ it.enseignements.toList().sort{it.id}.getAt(0).enseignant ==
+ serviceCible.enseignements.toList().sort{it.id}.getAt(0).enseignant } // cas 2.1, 2.2
+ }
+
+ /**
+ * Reporte les ordres de matieres et les coeeficients de la classe source vers
+ * une classe cible pour la periode/nature de periode donnee
+ * @param securiteSession
+ * @param report
+ */
+ private void reporteOrdreCoefficientsAuService(SecuriteSession securiteSession,
+ ReportServiceCorrespondance reportServiceCorrespondance) {
+
+ StructureEnseignement classeCible =
+ reportServiceCorrespondance.reportTraitement.classeCible
+ Service serviceCible =
+ reportServiceCorrespondance.reportTraitement.serviceCible
+ Service serviceSource = reportServiceCorrespondance.serviceSource
+ Report report = reportServiceCorrespondance.reportTraitement.report
+ NaturePeriode naturePeriode = report.naturePeriode
+ TypePeriode typePeriode = report.typePeriode
+ StructureEnseignement classeSource = report.classeSource
+
+ log.debug("Traitement d'ordre et des coefficients de ${serviceSource} -> ${serviceCible}")
+
+ // en tout cas, on change l'ordre
+ // si service trouve on report les coeffs
+ Map<TypePeriode, BigDecimal> coeffs = [:]
+ if (serviceSource) {
+ coeffs = construisCoeffsCopies(
+ serviceSource,
+ serviceCible,
+ naturePeriode,
+ typePeriode
+ )
+ }
+
+ ModifieRelPeriodeServiceResultat resultatModification =
+ notesRelPeriodeServiceService.modifieAllRelPeriodeService(
+ securiteSession,
+ serviceCible,
+ new NotesPeriodeParams(
+ ordre: reportServiceCorrespondance.serviceCibleOrdre,
+ coeffs: coeffs,
+ nature: naturePeriode,
+ typePeriode: typePeriode,
+ classe: classeSource
+ ),
+ false
+ )
+ if (resultatModification.coeffsChanges) {
+ marqueMoyennesArecalculer(securiteSession, serviceCible)
+ }
+
+
+ if (serviceSource) {
+ // traite les sous-services
+ reporteOrdreCoefficientsAuxSousServices(
+ securiteSession,
+ serviceSource,
+ serviceCible,
+ classeSource,
+ classeCible,
+ naturePeriode,
+ typePeriode
+ )
+ }
+
+ }
+
+ /**
+ * Reporte les ordres de sous-services et les coefficients de service source
+ * vers le service cible, s'il a des sous-services
+ * @param serviceSource
+ * @param serviceCible
+ * @param classeSource
+ * @param classeCible
+ * @param naturePeriode
+ * @param typePeriode
+ */
+ private void reporteOrdreCoefficientsAuxSousServices(SecuriteSession securiteSession,
+ Service serviceSource,
+ Service serviceCible,
+ StructureEnseignement classeSource,
+ StructureEnseignement classeCible,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriode) {
+
+ if (serviceSource.sousServices == null || serviceSource.sousServices.isEmpty()) {
+ return
+ }
+ if (serviceCible.sousServices == null || serviceCible.sousServices.isEmpty()) {
+ return
+ }
+
+ List<SousServiceOrdreInfo> ordresSource =
+ recupereSousServiceOrdres(serviceSource, naturePeriode, typePeriode)
+ List<SousServiceOrdreInfo> ordresCible =
+ recupereSousServiceOrdres(serviceCible, naturePeriode, typePeriode)
+
+ List<SousServiceOrdreInfo> sousServicesCommuns = [] // communs source+cible
+ List<SousServiceOrdreInfo> sousServicesEnPlus = [] // ne present que dans cible
+
+ ordresSource.each { SousServiceOrdreInfo ordreSourceInfo ->
+ SousServiceOrdreInfo ordreCibleInfo =
+ ordresCible.find { it.modaliteMatiere == ordreSourceInfo.modaliteMatiere }
+ if (ordreCibleInfo) {
+ sousServicesCommuns.add(ordreCibleInfo)
+ }
+ }
+
+ ordresCible.each { SousServiceOrdreInfo ordreCibleInfo ->
+ if (!ordresSource.find { it.modaliteMatiere == ordreCibleInfo.modaliteMatiere }) {
+ sousServicesEnPlus.add(ordreCibleInfo)
+ }
+ }
+
+ int nouvelOrdre = 1
+ sousServicesCommuns.each { SousServiceOrdreInfo ordreInfoCible ->
+ SousServiceOrdreInfo ordreInfoSource =
+ ordresSource.find { it.modaliteMatiere == ordreInfoCible.modaliteMatiere}
+
+ ordreInfoCible.sousServices.each { SousService sousServiceCible ->
+ sousServiceCible.ordre = nouvelOrdre
+ sousServiceCible.coeff =
+ chercheCoefficientSousServiceCorrespondent(
+ sousServiceCible,
+ ordreInfoSource.sousServices
+ )
+ sousServiceCible.save(failOnError: true)
+ }
+ nouvelOrdre++
+
+ uptodateService.marqueDirtySousService(
+ securiteSession,
+ classeCible,
+ serviceCible,
+ ordreInfoCible.sousServices.collect { it.typePeriode },
+ ordreInfoCible.modaliteMatiere
+ )
+ }
+
+ sousServicesEnPlus.each { SousServiceOrdreInfo ordreInfoCible ->
+ ordreInfoCible.sousServices.each { SousService sousServiceCible ->
+ sousServiceCible.ordre = nouvelOrdre
+ sousServiceCible.save(failOnError: true)
+ }
+ nouvelOrdre++
+ }
+
+ }
+
+ /**
+ * Cherche le coefficient source correspondent
+ * @param sousServiceCible
+ * @param sousServicesSource
+ * @return
+ */
+ private BigDecimal chercheCoefficientSousServiceCorrespondent(SousService sousServiceCible,
+ List<SousService> sousServicesSource) {
+
+ SousService sousServiceSource = sousServicesSource.
+ find { it.typePeriode == sousServiceCible.typePeriode }
+ if (!sousServiceSource) {
+ sousServiceSource = sousServicesSource.find {
+ it.typePeriode.intervalle == getIntervalleCorrespondant(
+ sousServiceCible.typePeriode.getIntervalle()
+ )
+ }
+ if (!sousServicesSource) {
+ throw new IllegalStateException(
+ "Sous-service correspondant pas trouvee. Sous-service cible: "+
+ "$sousServiceCible Sous-service source: $sousServicesSource")
+ }
+ }
+ return sousServiceSource.coeff
+
+ }
+
+ /**
+ * Recupere l'info sur l'ordre de sous-services trie
+ * par l'ordre pour la nature de periode / type de periode
+ * @param service
+ * @param naturePeriode
+ * @param typePeriode
+ * @return
+ */
+ private List<SousServiceOrdreInfo> recupereSousServiceOrdres(Service service,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriode) {
+ Map<ModaliteMatiere, List<SousService>> sousServicesParModalite =
+ filtreEtGroupeSousServices(service, naturePeriode, typePeriode)
+
+ return sousServicesParModalite.collect {
+ new SousServiceOrdreInfo(
+ modaliteMatiere: it.key,
+ sousServices: it.value,
+ // l'ordre de sous-services est le meme pour la
+ // meme nature de periode / type de periode
+ ordre: it.value.first().ordre
+ )
+ }.sort {it.ordre}
+ }
+
+ /**
+ * Marque qu'il faut recalculer les moyennes de services dont les
+ * coeeficients ont change
+ * @param securiteSession
+ * @param serviceArecalculer
+ */
+ private void marqueMoyennesArecalculer(SecuriteSession securiteSession,
+ Service serviceArecalculer) {
+ // marque les moyennes a recalculer ou necessaire
+ notesServiceService.marqueServiceDirtySiNecessaire(
+ securiteSession,
+ serviceArecalculer,
+ true,
+ false,
+ false
+ )
+ }
+
+ /**
+ * Construis une map pour mapper les coefficients de service source au service cible
+ * @param serviceSource
+ * @param serviceCible
+ * @param naturePeriode
+ * @param typePeriode
+ * @return
+ */
+ private Map<TypePeriode, BigDecimal> construisCoeffsCopies(Service serviceSource,
+ Service serviceCible,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriode) {
+ Map<TypePeriode, BigDecimal> coefficients = [:]
+
+ Set<RelPeriodeService> proprietesSource = serviceSource.relPeriodeServices.
+ findAll { typePeriode ?
+ it.periode.typePeriode == typePeriode :
+ it.periode.nature == naturePeriode}
+ Set<RelPeriodeService> proprietesCible = serviceCible.relPeriodeServices.
+ findAll { typePeriode ?
+ it.periode.typePeriode == typePeriode :
+ it.periode.nature == naturePeriode}
+
+ proprietesCible.each { RelPeriodeService proprieteCible ->
+ RelPeriodeService proprieteSource =
+ chercheProprieteCorrespondante(proprieteCible, proprietesSource)
+ coefficients.put(proprieteCible.periode.typePeriode, proprieteSource?.coeff)
+ }
+
+ return coefficients
+ }
+
+ /**
+ * Cherche une propriete correspondante dans le service de source.
+ * Si on a des services semestre/trimestre on fait un mapping de coeeficients.
+ * [S1->T1, S2->T2, S2->T3], [T1->S1, T2->S2]
+ * @param proprieteCible
+ * @param proprietesSource
+ * @return
+ */
+ private RelPeriodeService chercheProprieteCorrespondante(RelPeriodeService proprieteCible,
+ Set<RelPeriodeService> proprietesSource) {
+ RelPeriodeService proprieteSource = proprietesSource.
+ find { it.periode.typePeriode.id == proprieteCible.periode.typePeriode.id }
+
+ if (!proprieteSource) {
+ // il faut faire le mapping semestre <-> trimestre
+ proprieteSource = proprietesSource.
+ find { it.periode.intervalle ==
+ getIntervalleCorrespondant(proprieteCible.periode.getIntervalle())
+ }
+ if (!proprieteSource) {
+ throw new IllegalStateException(
+ "Propriete de service correspondant pas trouvee. Propriete cible: "+
+ "$proprieteCible Proprietes source: $proprietesSource")
+ }
+ }
+ return proprieteSource
+ }
+
+ /**
+ * Ordonne les service de la classeSource pour la nature/type de periode donnee
+ * @param classeSource
+ * @param services
+ * @param naturePeriode
+ * @param typePeriode
+ * @return
+ */
+ private List<Service> ordonneEtFiltreServices(StructureEnseignement classeSource,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriode,
+ Boolean sort = true) {
+
+ List<Service> services = notesServiceService.
+ findAllServiceByClassePeriode(classeSource, naturePeriode, typePeriode)
+
+ // semestre / trimestre
+ TypeIntervalleEnum typeIntervalleClasseSource =
+ classeSource.getTypeIntervalle()
+
+ if (sort) {
+ services.sort {
+
+ // une rel de Xmestre (toutes les memes) / rel de periode d'examen
+ RelPeriodeService relPeriodeService = typePeriode ?
+ it.relPeriodeServices.find { it.periode.typePeriode == typePeriode } :
+ it.relPeriodeServices.find {
+ it.periode.nature == naturePeriode &&
+ it.periode.getTypeIntervalle() == typeIntervalleClasseSource
+ }
+
+ // si une rel manque, le service est pris comme non-evaluable - le dernier
+ relPeriodeService ? relPeriodeService.ordre : Integer.MAX_VALUE
+
+ }
+ }
+ return services
+ }
+
+ /**
+ * Report les sous-services d'un service vers l'autre pour une nature/type de periode
+ * @param serviceSource
+ * @param serviceCible
+ */
+ private void reporteSousServicesAuService(SecuriteSession securiteSession,
+ Service serviceSource,
+ Service serviceCible,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriode) {
+
+ log.debug("Traitement de sous-services de ${serviceSource} -> ${serviceCible}")
+
+ // cas 1) classe cible n'a pas les sous-services - On ajoute les sous-matières
+ // de la classe de référence dans la classe de destination. On respecte
+ // l'ordre des sous-matières.
+
+ // cas 2) classe cible a les sous-services - Pour les sous-matières
+ // identiques on ne fait pas de traitement. Pour les sous-matières
+ // différentes, on ajoute les sous-matières de la classe de référence
+ // dans la classe de destination
+
+ Map<ModaliteMatiere, List<SousService>> sousServicesSource =
+ filtreEtGroupeSousServices(serviceSource, naturePeriode, typePeriode)
+
+ Map<ModaliteMatiere, List<SousService>> sousServicesCible =
+ filtreEtGroupeSousServices(serviceCible, naturePeriode, typePeriode)
+
+ List<NotesModaliteMatiereParams> sousServicesAajouter =
+ chercheSousServicesAajouter(
+ sousServicesSource,
+ sousServicesCible,
+ serviceCible,
+ typePeriode,
+ naturePeriode
+ )
+
+ sousServicesAajouter.each {
+ notesSousServiceService.internalCreeOrModifieSousService(
+ securiteSession,
+ it,
+ true)
+ }
+
+ }
+
+ /**
+ * Filtre les sous services par nature periode / type periode et regroupe les
+ * par modalite matiere
+ * @param service
+ * @param naturePeriode
+ * @param typePeriode
+ * @return
+ */
+ private Map<ModaliteMatiere, List<SousService>> filtreEtGroupeSousServices(Service service,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriode) {
+ return service.sousServices.
+ findAll { typePeriode ?
+ (it.typePeriode == typePeriode) :
+ (it.typePeriode.nature == naturePeriode)
+ }.groupBy { it.modaliteMatiere }
+ }
+
+ /**
+ * Cherche les sous services a ajouter.
+ * Sous services sont reprensentes par un DTO de leur proprietes et
+ * tries par l'ordre de typePeriode donne.
+ * @param sousServicesSource
+ * @param sousServicesCible
+ * @param serviceCible
+ * @param typePeriode
+ * @param naturePeriode
+ * @return
+ */
+ private List<NotesModaliteMatiereParams> chercheSousServicesAajouter(Map<ModaliteMatiere,List<SousService>> sousServicesSource,
+ Map<ModaliteMatiere,List<SousService>> sousServicesCible,
+ Service serviceCible,
+ TypePeriode typePeriode,
+ NaturePeriode naturePeriode) {
+
+ Map<Integer, NotesModaliteMatiereParams> mapParams = [:] // ordre, params
+
+ sousServicesSource.each { ModaliteMatiere modaliteMatiere,
+ List<SousService> sousServicesSourceMatiere ->
+
+ if (!sousServicesCible.get(modaliteMatiere)) {
+
+ Integer ordreRepresentant = typePeriode ?
+ sousServicesSourceMatiere.
+ find { it.typePeriode.id == typePeriode.id }.ordre :
+ sousServicesSourceMatiere.first().ordre
+
+
+ Map<TypePeriode, BigDecimal> coeffs = sousServicesSourceMatiere.
+ inject([:]) {map, col -> map << [(col.typePeriode): col.coeff]}
+
+ // on peut prendre n'importe quel sousService - ils ont tous la meme evaluabilite
+ Boolean evaluable = sousServicesSourceMatiere.first().evaluable
+
+ mapParams.put(
+ ordreRepresentant,
+ new NotesModaliteMatiereParams(
+ serviceParent: serviceCible,
+ modaliteMatiere: modaliteMatiere,
+ classe: serviceCible.structureEnseignement,
+ coeffs: coeffs,
+ typePeriode: typePeriode,
+ nature: naturePeriode,
+ evaluable: evaluable
+ )
+ )
+ }
+ }
+
+ // recoup des params tries par l'ordre
+ List<NotesModaliteMatiereParams> sousServicesAajouter =
+ mapParams.keySet().toList().sort { it }.collect { mapParams.get(it) }
+
+ return sousServicesAajouter
+ }
+
+
+ /**
+ * Mapping d'intevals pour le report.
+ * [S1->T1, S2->T2, S2->T3], [T1->S1, T2->S2]
+ * @param intervalle
+ * @return
+ */
+ private IntervalleEnum getIntervalleCorrespondant(IntervalleEnum intervalle) {
+ switch(intervalle) {
+ case IntervalleEnum.S1: return IntervalleEnum.T1
+ case IntervalleEnum.S2: return IntervalleEnum.T2
+ case IntervalleEnum.T1: return IntervalleEnum.S1
+ case IntervalleEnum.T2: return IntervalleEnum.S2
+ case IntervalleEnum.T3: return IntervalleEnum.S2
+ case IntervalleEnum.ANNEE: return IntervalleEnum.ANNEE
+ }
+ }
+
+ /**
+ * Cree un demande de report differe
+ * @param securiteSession
+ * @param etablissement
+ * @param reportParams
+ * @return demande id
+ */
+ Report creeDemandeReport(Autorite demandeur,
+ Etablissement etablissement,
+ ReportParams reportParams) {
+ Report report = null
+
+ StructureEnseignement.withTransaction {
+ report = reportService.creeReport(etablissement, reportParams)
+
+ reportParams.classesCibles.each { StructureEnseignement classeCible ->
+ List<Service> servicesAtraiter = ordonneEtFiltreServices(
+ classeCible,
+ reportParams.naturePeriode,
+ reportParams.typePeriode,
+ false
+ )
+ servicesAtraiter.each { Service serviceAtraiter ->
+ reportTraitementService.
+ creeReportTraitement(report, classeCible, serviceAtraiter)
+ }
+ }
+ }
+
+ return report
+ }
+
+}
--- /dev/null
+package org.lilie.services.eliot.notes.report
+
+import org.lilie.services.eliot.notes.Report
+import org.lilie.services.eliot.scolarite.Etablissement
+import org.lilie.services.eliot.notes.domaine.ReportParams
+
+/**
+ * Gestion de la classe domaine Report.
+ * Report aggrege l'information sur un report des proprietes des services
+ * d'une classe source aux services des classes sibles.
+ */
+class ReportService {
+
+ static transactional = false
+
+ /**
+ * Report par etablissement
+ * @param etablissement
+ * @return
+ */
+ Report findReportByEtablissement(Etablissement etablissement) {
+ return Report.createCriteria().get {
+ eq('etablissement', etablissement)
+ }
+ }
+
+ /**
+ * Cree un report
+ * @param etablissement
+ * @param reportParams
+ * @return
+ */
+ Report creeReport(Etablissement etablissement, ReportParams reportParams) {
+ Report report = new Report(
+ etablissement: etablissement,
+ classeSource: reportParams.classeSource,
+ naturePeriode: reportParams.naturePeriode,
+ typePeriode: reportParams.typePeriode,
+ reportSousServices: reportParams.sousMatieres,
+ reportOrdre: reportParams.ordreMatieres,
+ reportCoefficients: reportParams.coefficients
+ )
+ report.save(flush: true, failOnError: true)
+ return report
+ }
+
+ /**
+ * Supprime report et ses reportTraitements
+ * @param etablissement
+ */
+ void supprimeReport(Etablissement etablissement) {
+ findReportByEtablissement(etablissement)?.
+ delete(flush: true, failOnError: true)
+ }
+}
--- /dev/null
+package org.lilie.services.eliot.notes.report
+
+import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.notes.ReportTraitement
+
+/**
+ * Correspondence entre un service source, un service cible
+ * et l'ordre de service cible a positionner.
+ * @author msan
+ */
+class ReportServiceCorrespondance {
+
+ ReportTraitement reportTraitement
+ Service serviceSource
+ Integer serviceCibleOrdre
+
+ String toString() {
+ return "[$serviceCibleOrdre] [${reportTraitement?.serviceCible}] <- [${serviceSource}]"
+ }
+
+}
--- /dev/null
+package org.lilie.services.eliot.notes.report
+
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.scolarite.Etablissement
+import org.lilie.services.eliot.notes.ReportTraitement
+import org.lilie.services.eliot.notes.ReportTraitementEtat
+import org.lilie.services.eliot.notes.Report
+
+class ReportTraitementService {
+
+ ReportService reportService
+
+ static transactional = false
+
+ /**
+ * Traitements de report en cours
+ * @return
+ */
+ ReportProprietes findTraitementsEnCours(Etablissement etablissementCourant) {
+
+ Report report = reportService.findReportByEtablissement(etablissementCourant)
+
+ if (report == null) {
+ return null
+ }
+
+ ReportProprietes reportProprietes = new ReportProprietes(
+ classeSource: report.classeSource,
+ naturePeriode: report.naturePeriode,
+ typePriodeSource: report.typePeriode,
+ traitementsReport: report.reportTraitements.toList().sort {
+ it.classeCible.code +
+ it.serviceCible.matiere.codeGestion +
+ it.serviceCible.structureEnseignement.code
+ }
+ )
+
+ return reportProprietes
+
+ }
+
+ /**
+ * Marque debut de traitement d'un report
+ * @param report
+ * @param service
+ * @return id d'enregistrement de report
+ */
+ ReportTraitement creeReportTraitement(Report report,
+ StructureEnseignement classeCible,
+ Service serviceCible) {
+ ReportTraitement reportOptions = new ReportTraitement()
+ reportOptions.classeCible = classeCible
+ reportOptions.report = report
+ reportOptions.serviceCible = serviceCible
+ reportOptions.etat = ReportTraitementEtat.EN_ATTENTE
+ reportOptions.save(failOnError: true)
+ return reportOptions
+ }
+
+
+ /**
+ * Marque le debut de traitement d'un service cible
+ * @param reportTraitement
+ */
+ void marqueDebutTraitement(ReportTraitement reportTraitement) {
+ log.info("Traitement Debut structure: "+
+ "${reportTraitement.serviceCible.structureEnseignement} "+
+ "service: ${reportTraitement.serviceCible}")
+ reportTraitement.etat = ReportTraitementEtat.EN_COURS
+ reportTraitement.save(failOnError: true, flush: true)
+ }
+
+ /**
+ * Marque la fin de traitement d'un service cible
+ * @param reportTraitement
+ */
+ void marqueFinTraitement(ReportTraitement reportTraitement) {
+ log.info("Traitement Fin structure: "+
+ "${reportTraitement.serviceCible.structureEnseignement} "+
+ "service: ${reportTraitement.serviceCible}")
+ reportTraitement.etat = ReportTraitementEtat.TERMINE
+ reportTraitement.save(failOnError: true, flush: true)
+ }
+
+ /**
+ * Marque l'erreur de traitement d'un service cible
+ * @param reportTraitement
+ */
+ void marqueErreurTraitement(ReportTraitement traitement) {
+ ReportTraitement.withNewSession {session ->
+ traitement = ReportTraitement.get(traitement.id)
+
+ log.info("Traitement Erreur structure: "+
+ "${traitement.serviceCible.structureEnseignement} "+
+ "service: ${traitement.serviceCible}")
+
+ traitement.etat = ReportTraitementEtat.ERREUR
+
+ session.save(traitement)
+ session.flush()
+ }
+ }
+
+ /**
+ * Supprime les reportTraitements EN_ATTENTE.
+ * Cela est utilise pour interrompre le report en cours.
+ * @param etablissementCourant
+ */
+ void supprimeReportsTraitementEnAttente(Etablissement etablissementCourant) {
+ ReportTraitement.createCriteria().list {
+ eq('etat',ReportTraitementEtat.EN_ATTENTE)
+ classeCible {
+ eq('etablissement.id', etablissementCourant.id)
+ }
+ }.each {
+ it.delete(flush: true)
+ }
+ }
+
+}
--- /dev/null
+package org.lilie.services.eliot.notes.report
+
+import org.lilie.services.eliot.scolarite.ModaliteMatiere
+import org.lilie.services.eliot.scolarite.SousService
+
+/**
+ * Info utilise pour le report d'ordre des sous-services
+ * @author msan
+ */
+class SousServiceOrdreInfo {
+ ModaliteMatiere modaliteMatiere
+ Integer ordre
+ List<SousService> sousServices
+}
import org.lilie.services.eliot.notes.DirtyMoyenne
import org.hibernate.FetchMode
import org.hibernate.criterion.CriteriaSpecification
+import org.lilie.services.eliot.notes.ReportTraitement
+import org.lilie.services.eliot.notes.ReportTraitementEtat
/**
* Service qui lance le calcul des moyennes avec une transaction pour chaque calcul.
* Attention ! La classe pour laquelle le calcul est en cours est aussi
* retournée dans le cas où le delai d'expiration de verrou est dépassé.
*
- * @param classeAExclureIds Les id des classes à exclure (classes déjà traitées)
+ * @param classeDejaTraiteeIds Les id des classes à exclure (classes déjà traitées)
* @return La classe à traiter en priorité
* @author bper
*/
- private StructureEnseignement internalFindClasseATraiter(List<Long> classeAExclureIds) {
+ private StructureEnseignement internalFindClasseATraiter(List<Long> classeDejaTraiteeIds) {
Calendar cal = GregorianCalendar.getInstance(Locale.FRANCE)
cal.add(Calendar.MILLISECOND, (-1)*LOCK_TIMEOUT)
Date dateExpirationVerrou = cal.getTime()
+ List<Long> classeAExclureIds = classeDejaTraiteeIds + findClasseIdsTraitementReportEnCours()
+
StructureEnseignement classe = (StructureEnseignement) DirtyMoyenne.createCriteria().get {
createAlias('periode.classe','cls')
createAlias('cls.infoCalculMoyennesClasses','infoCalcul', CriteriaSpecification.LEFT_JOIN)
return classe
}
+
+
+ private List<Long> findClasseIdsTraitementReportEnCours() {
+
+ return ReportTraitement.createCriteria().list {
+ createAlias('classeCible','classeCible')
+
+ projections {
+ property('classeCible.id')
+ }
+
+ 'in'('etat', [ReportTraitementEtat.EN_ATTENTE, ReportTraitementEtat.EN_COURS])
+ }
+ }
}
ModaliteMatiere modaliteMatiere // modaliteMatiereId
ModaliteMatiere nouveauModaliteMatiere // nouveauModaliteMatiereId
StructureEnseignement classe // classe sélectionnée
- Map<TypePeriode, BigDecimal> coeffs // <idTypePeriode: coeff>
+ Map<TypePeriode, BigDecimal> coeffs // <TypePeriode: coeff>
TypePeriode typePeriode
NaturePeriode nature
Boolean evaluable
*/
class NotesPeriodeParams {
Integer ordre
- Map<TypePeriode, BigDecimal> coeffs // <TypePeriode: coeff>
+ Map<TypePeriode, BigDecimal> coeffs = [:]// <TypePeriode: coeff>
Boolean option
Boolean evaluable
NaturePeriode nature
import org.lilie.services.eliot.scolarite.Service
import org.lilie.services.eliot.annuaire.SecuriteSession
import org.lilie.services.eliot.scolarite.SousService
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.scolarite.TypePeriode
class NotesRelPeriodeServiceService extends RelPeriodeServiceService {
* @author jtra
*/
ModifieRelPeriodeServiceResultat modifieAllRelPeriodeService(SecuriteSession securiteSession,
- Service service,
- NotesPeriodeParams periodeParams,
- Boolean creationService) {
+ Service service,
+ NotesPeriodeParams periodeParams,
+ Boolean creationService) {
Boolean recharger = false // // l'info que le FO doit recharger la grille des services
Boolean coeffsChanges = false // coefficients ont changé
Boolean evaluabiliteChange = false // évaluablilité a changé
return besoinRecharger
}
-
}
* coefficiant et evaluable
* Pour les service créés manualement (origine = MANUEL) modifier aussi les
* enseignants,
- * la modalité de cours, la structure d'enseignement et et la matière.
+ * la modalité de cours, la structure d'enseignement et la matière.
*
* @param securiteSession la session de sécurité courante
* @param etablissementCourant
* @param evaluabiliteChange
* @param optionChange
*/
- private void marqueServiceDirtySiNecessaire(SecuriteSession securiteSession,
+ void marqueServiceDirtySiNecessaire(SecuriteSession securiteSession,
Service service,
Boolean coeffsChanges,
Boolean evaluabiliteChange,
service.save(failOnError: true, flush: true)
}
}
+
+ /**
+ * Recupere les services evaluables de classe avec les sous-services
+ * pour naturePeriode/typePeriode donne
+ * @param classes
+ * @return
+ */
+ List<Service> findAllServiceByClassePeriode(StructureEnseignement classesParent,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriodeCherche) {
+ Service.createCriteria().listDistinct {
+ structureEnseignement {
+ or {
+ 'in'('id', classesParent*.id)
+ classes {
+ 'in'('id', classesParent*.id)
+ }
+ }
+ }
+ fetchMode('structureEnseignementSts', FetchMode.JOIN)
+ fetchMode('structureEnseignementNotes', FetchMode.JOIN)
+ fetchMode('preferences', FetchMode.JOIN)
+
+ relPeriodeServices {
+ eq('evaluable', true)
+ periode {
+ typePeriode {
+ eq('nature', naturePeriode)
+ if (typePeriodeCherche) {
+ eq('id', typePeriodeCherche.id)
+ }
+ }
+ }
+ }
+
+ eq('servicePrincipal', true)
+ fetchMode('sousServices', FetchMode.JOIN)
+ fetchMode('matiere', FetchMode.JOIN)
+ }
+ }
}
\ No newline at end of file
* Cree ou modifie un sous-service
* @author msan
*/
- private ResultatModification internalCreeOrModifieSousService(SecuriteSession securiteSession,
+ ResultatModification internalCreeOrModifieSousService(SecuriteSession securiteSession,
NotesModaliteMatiereParams params,
Boolean creation) {
ResultatModification resultatModification = new ResultatModification()
// Quand on crée le première sous-service, il faut passer
// tout les devoirs de service à son sous-service
if (serviceDevientServiceAvecSousServices) {
- passeDavoirsResultatsASousService(
+ passeDevoirsResultatsASousService(
service,
mmFinal,
sousService,
* @param sousService
* @param typePeriode
*/
- private void passeDavoirsResultatsASousService(Service service,
+ private void passeDevoirsResultatsASousService(Service service,
ModaliteMatiere modaliteMatiere,
SousService sousService,
TypePeriode typePeriode) {
import org.lilie.services.eliot.scolarite.personne.eleve.EleveAnnuaireService
import org.lilie.services.eliot.annuaire.FonctionEnum
import org.lilie.services.eliot.notes.NotesFonction
+import org.lilie.services.eliot.scolarite.NaturePeriode
/**
* Extension de LocalStructureEnseignementService pour eliot-notes
}
}
+ /**
+ * Cherche classe avec les extensions StructureEnseignement*
+ * @param classeId
+ * @return StructureEnseignement
+ * @author msan
+ */
+ StructureEnseignement getClasseAvecExtensions(Long classeId) {
+ return StructureEnseignement.createCriteria().get {
+ eq('id', classeId)
+ fetchMode('etablissement', FetchMode.JOIN)
+ fetchMode('structureEnseignementSts', FetchMode.JOIN)
+ fetchMode('structureEnseignementNotes', FetchMode.JOIN)
+ fetchMode('preferences', FetchMode.JOIN)
+ }
+ }
+
+ /**
+ * Cherche les classe avec les périodes fetchées
+ * @param classeId
+ * @return StructureEnseignement
+ * @author msan
+ */
+ List<StructureEnseignement> getClasseAvecPeriodes(List<Long> classeIds) {
+ if (classeIds.isEmpty()) {
+ return []
+ }
+ return StructureEnseignement.createCriteria().listDistinct {
+ 'in'('id', classeIds)
+ fetchMode('periode', FetchMode.JOIN)
+ fetchMode('periode.typePeriode', FetchMode.JOIN)
+ }
+ }
+
/**
* Retourne la liste de classes cibles pour le report de parametrage.
* @param securiteSession
fetchMode('periodes',FetchMode.JOIN)
}
}
+
+ /**
+ * Retourne toutes les classes de l'établissement etant attaches aux
+ * periodes de la nature donnee ou le type de periode donne.
+ * @param securiteSession
+ * @param etablissement
+ * @param naturePeriode
+ * @param typePeriodeCherche (optionel)
+ * @return Liste de classes
+ */
+ List<StructureEnseignement> findAllClasseForEtablissementNatureTypePeriode(SecuriteSession securiteSession,
+ Etablissement etablissement,
+ NaturePeriode naturePeriode,
+ TypePeriode typePeriodeCherche) {
+ notesDroitService.verifieAutorisationByEtablissement(
+ securiteSession,
+ etablissement,
+ Action.CONSULTATION,
+ NotesFonction.DIRECTION_ASSIMILE
+ )
+
+ return StructureEnseignement.createCriteria().listDistinct {
+ eq('anneeScolaire',anneeScolaireService.anneeScolaireEnCours())
+ eq('type',StructureEnseignement.TYPE_CLASSE)
+ eq('etablissement',etablissement)
+ periodes {
+ typePeriode {
+ if (typePeriodeCherche) {
+ eq('id', typePeriodeCherche.id)
+ }
+ eq('nature', naturePeriode)
+ }
+ }
+ fetchMode('structureEnseignementSts', FetchMode.JOIN)
+ fetchMode('structureEnseignementNotes', FetchMode.JOIN)
+ fetchMode('preferences', FetchMode.JOIN)
+ }
+ }
+
}
import org.lilie.services.eliot.notes.brevet.NoteTextuellesEnum
import org.lilie.services.eliot.brevet.BrevetFiche
import org.lilie.services.eliot.securite.impl.CompteUtilisateurEtat
+import org.lilie.services.eliot.scolarite.SousService
+import org.lilie.services.eliot.test.PopulationTestModaliteMatiere
+import org.lilie.services.eliot.scolarite.ModaliteMatiere
/**
* Données de test et méthodes d'utilité
SessionFactory sessionFactory
void initDonneesTest() {
-
// Récupération de la structure CLASSE_1 Etab 1
- StructureEnseignement classe1enTrimestres =
- localInitDonneesCommunesTestService.getClasse(
+ StructureEnseignement classe1enTrimestres = localInitDonneesCommunesTestService.getClasse(
PopulationTestClasse.HORS_ANNUAIRE_CLASSE_1
)
- classe1enTrimestres?.structureEnseignementNotes.typeIntervalle = TypeIntervalleEnum.TRIMESTRE
- classe1enTrimestres.save()
-
- getOuCreePeriode(initPeriodeTestService.t3, classe1enTrimestres)
- getOuCreePeriode(initPeriodeTestService.t1, classe1enTrimestres)
- getOuCreePeriode(initPeriodeTestService.t2, classe1enTrimestres)
- getOuCreePeriode(initPeriodeTestService.annee, classe1enTrimestres)
- Matiere matiere1 = localInitDonneesCommunesTestService.
- getMatiere(PopulationTestMatiere.ANGLAIS)
- // crée des services pour C1
- creeService(matiere1, classe1enTrimestres)
+ initPeriodesTrimestre(classe1enTrimestres)
+ creeService(PopulationTestMatiere.ANGLAIS, classe1enTrimestres)
}
/**
return periode
}
+ void initPeriodesTrimestre(StructureEnseignement classe) {
+ classe?.structureEnseignementNotes.typeIntervalle = TypeIntervalleEnum.TRIMESTRE
+ classe.save()
+
+ getOuCreePeriode(initPeriodeTestService.t1, classe)
+ getOuCreePeriode(initPeriodeTestService.t2, classe)
+ getOuCreePeriode(initPeriodeTestService.t3, classe)
+ getOuCreePeriode(initPeriodeTestService.annee, classe)
+ }
+
+ void initPeriodesSemestre(StructureEnseignement classe) {
+ classe?.structureEnseignementNotes.typeIntervalle = TypeIntervalleEnum.SEMESTRE
+ classe.save()
+
+ getOuCreePeriode(initPeriodeTestService.s1, classe)
+ getOuCreePeriode(initPeriodeTestService.s2, classe)
+ getOuCreePeriode(initPeriodeTestService.annee, classe)
+ }
+
/**
* Crée un service minimal
* @param matiere matière
return service
}
+ Service creeService(PopulationTestMatiere populationTestMatiere,
+ StructureEnseignement structureEnseignement) {
+ Matiere matiere =
+ localInitDonneesCommunesTestService.getMatiere(populationTestMatiere)
+ return creeService(matiere, structureEnseignement)
+ }
+
+ SousService creeSousService(PopulationTestModaliteMatiere populationTestModaliteMatiere,
+ Service service,
+ TypePeriode typePeriode,
+ Boolean evaluable,
+ BigDecimal coefficient,
+ Integer ordre = null) {
+
+ ModaliteMatiere modaliteMatiere =
+ localInitDonneesCommunesTestService.getModaliteMatiere(populationTestModaliteMatiere)
+
+ SousService sousService = new SousService(
+ modaliteMatiere: modaliteMatiere,
+ service: service,
+ typePeriode: typePeriode,
+ evaluable: evaluable,
+ coeff: coefficient
+ )
+ if (ordre!=null) {
+ sousService.ordre = ordre
+ }
+ service.addToSousServices(sousService)
+ sousService.save(flush: true, failOnError: true)
+ return sousService
+ }
+
+ void creeServices(List<PopulationTestMatiere> populationTestMatieres,
+ StructureEnseignement structureEnseignement) {
+
+ populationTestMatieres.each {
+ creeService(it, structureEnseignement)
+ }
+ }
+
/**
* Attache service à toutes les périodes de la structure
* @param structureEnseignement
<link rel="stylesheet" type="text/css" href="${resource(dir: 'js/lib/extjs/3.2.0/resources/css', file: 'Ext.ux.form.LovCombo.css')}"/>
+<g:javascript library="src/views/commun/AjaxHelper"/>
+
<!-- Importation de tous les JS qui concernent à cette page -->
+ <g:javascript library="src/views/Modele"/>
<g:javascript library="src/views/parametrages/services/Constantes"/>
<g:javascript library="src/views/parametrages/services/ConfigServeur"/>
+ <!-- Template pour les définitions des constantes -->
+ <g:render template="/modele"/>
+
+
<g:javascript>
<g:setJsNs value="eliot.notes.parametrages.services"/>
<g:setJsValueMessage name="confirmationSuppressionSousMatierePourRegroupement"
code="eliot.notes.message.confirmation.suppression.sousMatierePourRegroupement"/>
- // Libellés
+ <g:setJsValueMessage name="enCoursAppliqueA"
+ code="eliot.notes.parametrages.service.message.enCoursAppliqueA"/>
+ <g:setJsValueMessage name="confirmationAppliqueA"
+ code="eliot.notes.parametrages.service.message.confirmationAppliqueA"/>
+ <g:setJsValueMessage name="erreurAppliqueA"
+ code="eliot.notes.parametrages.service.message.erreurAppliqueA"/>
+ <g:setJsValueMessage name="erreurListeClassesAppliqueA"
+ code="eliot.notes.message.erreurInconnue"/>
+ <g:setJsValueMessage name="avertissementAppliquerA"
+ code="eliot.notes.message.avertissement.appliquerA"/>
+
+ <g:setJsValueMessage name="erreurValider"
+ code="eliot.notes.message.erreurInconnue"/>
+ <g:setJsValueMessage name="erreurInterrompre"
+ code="eliot.notes.message.erreurInconnue"/>
+ <g:setJsValueMessage name="traitementEnCoursMsg"
+ code="notes.parametrage.tableservice.traitementEnCoursMsg"/>
+ <g:setJsValueMessage name="finTraitementMsg"
+ code="notes.parametrage.tableservice.finTraitementMsg"/>
+
+// Libellés
<g:setJsVar value="ConfigServeur.libelle"/>
+ <g:setJsValueMessage name="ok" code="eliot.notes.libelle.ok"/>
+ <g:setJsValueMessage name="annuler" code="eliot.notes.libelle.annuler"/>
+
<g:setJsValueMessage name="ordre" code="eliot.notes.libelle.ordreAffichage"/>
<g:setJsValueMessage name="coeff" code="eliot.notes.libelle.coeff"/>
<g:setJsValueMessage name="lblMatiere" code="eliot.notes.libelle.lblMatiere"/>
<g:setJsValueMessage name="servicesEvaluables" code="notes.parametrage.tableservice.group.servicesEvaluables"/>
<g:setJsValueMessage name="servicesNonEvaluables" code="notes.parametrage.tableservice.group.servicesNonEvaluables"/>
- // Icônes
+ <g:setJsValueMessage name="appliquerA" code="eliot.notes.libelle.appliquerA"/>
+
+ <g:setJsValueMessage name="selectionParams" code="eliot.notes.parametrages.service.libelle.selectionParams"/>
+ <g:setJsValueMessage name="paramAppliqueA" code="eliot.notes.parametrages.service.libelle.paramAppliqueA"/>
+ <g:setJsValueMessage name="classesAModifier" code="eliot.notes.parametrages.service.libelle.classesAModifier"/>
+
+ <g:setJsValueMessage name="ordreMatieres" code="eliot.notes.parametrages.service.libelle.ordreMatieres"/>
+ <g:setJsValueMessage name="coefficients" code="eliot.notes.parametrages.service.libelle.coefficients"/>
+ <g:setJsValueMessage name="sousMatieres" code="eliot.notes.parametrages.service.libelle.sousMatieres"/>
+
+ <g:setJsValueMessage name="actualiser" code="notes.parametrage.tableservice.actualiser"/>
+ <g:setJsValueMessage name="valider" code="notes.parametrage.tableservice.btnValidationText"/>
+ <g:setJsValueMessage name="interrompre" code="notes.parametrage.tableservice.interrompre"/>
+ <g:setJsValueMessage name="classe" code="notes.parametrage.tableservice.classe"/>
+ <g:setJsValueMessage name="statut" code="notes.parametrage.tableservice.statut"/>
+
+// Icônes
<g:setJsVar value="ConfigServeur.icon"/>
<g:setJsValueResource name="creation" dir="images" file="add16x16.gif"/>
<g:setJsValueResource name="modification" dir="images" file="edit.png"/>
<g:setJsValueResource name="suppression" dir="images" file="delete.gif"/>
+ <g:setJsValueResource name="actualiser" dir="images" file="refresh.gif"/>
+ <g:setJsValueResource name="valider" dir="images" file="enregistrer.gif"/>
+ <g:setJsValueResource name="interrompre" dir="images" file="undo.gif"/>
+
// Url
<g:setJsVar value="ConfigServeur.url"/>
<g:setJsValueLink name="urlPage" controller="parametragesServices" action="index"/>
<g:setJsValueLink name="urlSupprimerSousMatiere" controller="sousService" action="actionSupprimeSousService"/>
<g:setJsValueLink name="urlExcuterSupprimerSousMatiere" controller="sousService" action="executeSupprimeSousService"/>
- // Data
+ <g:setJsValueLink name="urlListeClassesAppliqueA" controller="structureEnseignement" action="listeClassesParNaturePeriode"/>
+ <g:setJsValueLink name="urlAppliqueA" controller="parametragesServices" action="lanceReport"/>
+ <g:setJsValueLink name="valide" controller="parametragesServices" action="valideReport"/>
+ <g:setJsValueLink name="interromps" controller="parametragesServices" action="interrompsReport"/>
+
+ // Data
<g:setJsVar value="ConfigServeur.data"/>
<g:setJsValueBoolean name="isRegroupement" value="${isRegroupement}"/>
+ <g:setJsValueJson name="traitementEnCours" value="${traitementEnCours}"/>
// Liste des classes
<g:each var="classe" in="${classes}">
<g:javascript library="src/views/parametrages/services/ServiceController"/>
<g:javascript library="src/views/parametrages/services/ServiceView"/>
<g:javascript library="src/views/parametrages/services/ToolbarView"/>
+ <g:javascript library="src/views/parametrages/services/TraitementEnCoursView"/>
+ <g:javascript library="src/views/parametrages/services/TraitementEnCoursToolbarView"/>
+ <g:javascript library="src/views/parametrages/services/TraitementEnCoursController"/>
<g:javascript library="src/views/parametrages/services/Application"/>
</head>
* @param modalite
* @return sous-service
*/
- private SousService creeSousService(
- Service service,
- TypePeriode typePeriode,
- ModaliteMatiere modaliteMatiere) {
- SousService rel = new SousService(
+ private SousService creeSousService(Service service,
+ TypePeriode typePeriode,
+ ModaliteMatiere modaliteMatiere) {
+ SousService sousService = new SousService(
modaliteMatiere: modaliteMatiere,
service: service,
typePeriode: typePeriode,
evaluable: true, // par défaut
coeff: 1 // par défaut
)
- service.addToSousServices(rel)
- rel.save(flush: true)
- return rel
+ service.addToSousServices(sousService)
+ sousService.save(flush: true)
+ return sousService
}
/**
* Crée ou get une evaluation attaché a une periode
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot.notes
+
+import grails.test.GrailsUnitTestCase
+
+import org.lilie.services.eliot.notes.domaine.ReportParams
+import org.lilie.services.eliot.notes.test.InitDonneesNotesTestService
+import org.lilie.services.eliot.test.InitPeriodeTestService
+import org.lilie.services.eliot.test.LocalInitDonneesCommunesTestService
+import org.lilie.services.eliot.test.PopulationTestEtablissement
+import org.lilie.services.eliot.test.PopulationTestActeur
+import org.lilie.services.eliot.test.PopulationTestClasse
+import org.lilie.services.eliot.test.PopulationTestMatiere
+import org.lilie.services.eliot.scolarite.Etablissement
+import org.lilie.services.eliot.notes.report.ReportProprietesService
+import org.lilie.services.eliot.annuaire.SecuriteSession
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.scolarite.RelPeriodeService
+import org.lilie.services.eliot.notes.scolarite.NotesRelPeriodeServiceService
+import org.lilie.services.eliot.test.PopulationTestModaliteMatiere
+import org.lilie.services.eliot.scolarite.SousService
+import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
+
+import org.lilie.services.eliot.scolarite.anneescolaire.AnneeScolaireService
+import org.lilie.services.eliot.scolarite.TypeIntervalleEnum
+import org.lilie.services.eliot.scolarite.IntervalleEnum
+
+class ReportProprietesServiceTests extends GrailsUnitTestCase {
+
+ ReportProprietesService reportProprietesService
+ NotesRelPeriodeServiceService notesRelPeriodeServiceService
+
+ LocalInitDonneesCommunesTestService localInitDonneesCommunesTestService
+ LocalStructureEnseignementService localStructureEnseignementService
+ InitDonneesNotesTestService initDonneesNotesTestService
+ InitPeriodeTestService initPeriodeTestService
+ AnneeScolaireService anneeScolaireService
+
+ Etablissement etablissement
+ SecuriteSession securiteSession
+
+ protected void setUp() {
+ super.setUp()
+ initPeriodeTestService.initialisePeriodesDeTest()
+ initDonneesNotesTestService.initDonneesTest()
+
+ etablissement = localInitDonneesCommunesTestService.getEtablissement(
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ )
+
+ securiteSession = localInitDonneesCommunesTestService.getSecuriteSession(
+ PopulationTestActeur.DIRECTION_1
+ )
+ }
+
+ /**
+ * Test de changement des coefficients
+ */
+ void testCoeff() {
+
+ BigDecimal coeffPortugais = 2;
+ BigDecimal coeffChinois = 3;
+ BigDecimal coeffBasque = 4;
+
+ StructureEnseignement classeSource = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1
+ )
+
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.PORTUGAIS,
+ PopulationTestMatiere.CHINOIS,
+ PopulationTestMatiere.BASQUE
+ ], classeSource)
+
+ StructureEnseignement classeCible = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1_2
+ )
+
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.PORTUGAIS,
+ PopulationTestMatiere.CHINOIS,
+ PopulationTestMatiere.BASQUE
+ ], classeCible)
+
+
+ List<Service> servicesSource = Service.findAllByStructureEnseignement(classeSource)
+ servicesSource.each { service ->
+
+ switch (service.matiere.codeGestion) {
+ case PopulationTestMatiere.PORTUGAIS.codeGestion:
+ setCoeff(service, coeffPortugais)
+ break;
+
+ case PopulationTestMatiere.CHINOIS.codeGestion:
+ setCoeff(service, coeffChinois)
+ break;
+
+ case PopulationTestMatiere.BASQUE.codeGestion:
+ setCoeff(service, coeffBasque)
+ break;
+
+ }
+
+ }
+
+ List<Service> servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+
+ prepareTraitements(classeSource, classeCible, servicesCibles, false, true, false)
+ reportProprietesService.lanceReportDeProprietes()
+
+ servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+ servicesCibles.each { service ->
+ service.refresh() // pour recuperer l'etat actuel de la base
+
+ switch (service.matiere.codeGestion) {
+ case PopulationTestMatiere.PORTUGAIS.codeGestion:
+ assertCoeff(service, coeffPortugais)
+ break;
+
+ case PopulationTestMatiere.CHINOIS.codeGestion:
+ assertCoeff(service, coeffChinois)
+ break;
+
+ case PopulationTestMatiere.BASQUE.codeGestion:
+ assertCoeff(service, coeffBasque)
+ break;
+ }
+ }
+
+ }
+
+ /**
+ * Test de changement des coefficients de sous-services
+ */
+ void testCoeffSousServices() {
+
+ BigDecimal coeffBasque = 4;
+ BigDecimal coeffBasqueEcrit = 22;
+ BigDecimal coeffBasqueOral = 33;
+
+ // Service source
+ StructureEnseignement classeSource = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1
+ )
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.BASQUE
+ ], classeSource)
+ Service serviceSource = Service.findAllByStructureEnseignement(classeSource).
+ find { it.matiere.codeGestion == PopulationTestMatiere.BASQUE.codeGestion }
+ setCoeff(serviceSource, coeffBasque)
+
+ SousServicesParametres parametresServiceSource = new SousServicesParametres(
+ ecritCoefficient: coeffBasqueEcrit,
+ ecritEvaluable: true,
+ ecritOrdre: 1,
+ oralCoefficient: coeffBasqueOral,
+ oralEvaluable: false,
+ oralOrdre: 2
+ )
+ attacheSousServices(serviceSource, parametresServiceSource)
+
+ // Service cible
+ StructureEnseignement classeCible = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1_2
+ )
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.BASQUE
+ ], classeCible)
+ List<Service> servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+ Service serviceCible = servicesCibles.
+ find { it.matiere.codeGestion == PopulationTestMatiere.BASQUE.codeGestion }
+ attacheSousServices(
+ serviceCible,
+ new SousServicesParametres(
+ ecritCoefficient: 17,
+ ecritEvaluable: true,
+ ecritOrdre: 1,
+ oralCoefficient: 17,
+ oralEvaluable: true,
+ oralOrdre: 2
+ ))
+
+ // Traitement
+ prepareTraitements(classeSource, classeCible, servicesCibles, false, true, false)
+ reportProprietesService.lanceReportDeProprietes()
+
+ // Verification
+ servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+ serviceCible = servicesCibles.
+ find { it.matiere.codeGestion == PopulationTestMatiere.BASQUE.codeGestion }
+ serviceCible.refresh()
+ assertCoeff(serviceCible, coeffBasque)
+ assertCoeffsSousServices(
+ serviceCible,
+ parametresServiceSource.ecritCoefficient,
+ parametresServiceSource.oralCoefficient
+ )
+
+ }
+
+ /**
+ * Test de changement d'ordres de sous-services
+ */
+ void testOrdreSousServices() {
+
+ // il faut que le service soit premiere. sinon on ne peut pas guarantir
+ // l'ordre de servcies car on ne connait pas les services existants
+ // de la classe source
+ Integer ordreBasque = 1
+
+ // Service source
+ StructureEnseignement classeSource = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1
+ )
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.BASQUE
+ ], classeSource)
+ Service serviceSource = Service.findAllByStructureEnseignement(classeSource).
+ find { it.matiere.codeGestion == PopulationTestMatiere.BASQUE.codeGestion }
+ setOrdre(serviceSource, ordreBasque)
+
+ SousServicesParametres parametresServiceSource = new SousServicesParametres(
+ ecritCoefficient: 1,
+ ecritEvaluable: true,
+ ecritOrdre: 1,
+ oralCoefficient: 1,
+ oralEvaluable: false,
+ oralOrdre: 2
+ )
+ attacheSousServices(serviceSource, parametresServiceSource) // Ecrit = 1, Oral = 2
+
+ // Service cible
+ StructureEnseignement classeCible = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1_2
+ )
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.BASQUE
+ ], classeCible)
+ List<Service> servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+ Service serviceCible = servicesCibles.
+ find { it.matiere.codeGestion == PopulationTestMatiere.BASQUE.codeGestion }
+ attacheSousServices(
+ serviceCible,
+ new SousServicesParametres(
+ ecritCoefficient: 17,
+ ecritEvaluable: true,
+ ecritOrdre: 2,
+ oralCoefficient: 17,
+ oralEvaluable: true,
+ oralOrdre: 1
+ )) // Oral = ordre 1, Ecrit = ordre 2
+
+ // Traitement
+ prepareTraitements(classeSource, classeCible, servicesCibles, true, false, false)
+ reportProprietesService.lanceReportDeProprietes()
+
+ // Verification
+ servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+ serviceCible = servicesCibles.
+ find { it.matiere.codeGestion == PopulationTestMatiere.BASQUE.codeGestion }
+ serviceCible.refresh()
+ assertOrdre(serviceCible, ordreBasque)
+ assertOrdreSousServices(
+ serviceCible,
+ parametresServiceSource.ecritOrdre,
+ parametresServiceSource.oralOrdre
+ )
+
+ }
+
+ /**
+ * Cree les sous-services d'ecrit et d'oral et attache les au service.
+ * Si le coefficient est null, le sous-service n'est pas cree
+ * @param service
+ * @param parametres Parametres de sous-services
+ */
+ void attacheSousServices(Service service, SousServicesParametres parametres) {
+ service.relPeriodeServices.each {
+ if (parametres.ecritCoefficient!=null) {
+ initDonneesNotesTestService.creeSousService(
+ PopulationTestModaliteMatiere.ECRIT_ETAB1,
+ service,
+ it.periode.typePeriode,
+ parametres.ecritEvaluable,
+ parametres.ecritCoefficient,
+ parametres.ecritOrdre
+ )
+ }
+ if (parametres.oralCoefficient!=null) {
+ initDonneesNotesTestService.creeSousService(
+ PopulationTestModaliteMatiere.ORAL_ETAB1,
+ service,
+ it.periode.typePeriode,
+ parametres.oralEvaluable,
+ parametres.oralCoefficient,
+ parametres.oralOrdre
+ )
+ }
+ }
+
+ }
+
+ /**
+ * Prepare les reportTraitements pour l'execution
+ * @param classeSource
+ * @param classeCible
+ * @param servicesCible
+ * @param ordre
+ * @param coefficients
+ */
+ void prepareTraitements(StructureEnseignement classeSource,
+ StructureEnseignement classeCible,
+ List<Service> servicesCible,
+ Boolean ordre,
+ Boolean coefficients,
+ Boolean sousServices) {
+ Report report = reportProprietesService.creeDemandeReport(
+ securiteSession.defaultAutorite,
+ etablissement,
+ new ReportParams(
+ classeSource: classeSource,
+ classesCibles: [classeCible],
+
+ ordreMatieres: ordre,
+ coefficients: coefficients,
+ sousMatieres: sousServices,
+
+ naturePeriode: NaturePeriode.NOTATION,
+ typePeriode: null
+ ))
+
+ }
+
+ /**
+ * Positionne les coefficients des periodes de notation
+ * @param service
+ * @param coeff
+ */
+ private void setCoeff(Service service, BigDecimal coeff) {
+ List<RelPeriodeService> relPeriodeServices = RelPeriodeService.findAllByService(service)
+
+ relPeriodeServices.each {
+ if (it.periode.typePeriode.nature == NaturePeriode.NOTATION) {
+ it.coeff = coeff
+ it.save(flush: true)
+ }
+ }
+ }
+
+ /**
+ * Positionne les coefficients par intervalle (S1, S2, T1 ...)
+ * @param service
+ * @param coeffMap
+ */
+ private void setCoeff(Service service, Map<IntervalleEnum, BigDecimal> coeffMap) {
+ List<IntervalleEnum> intervalles = coeffMap.keySet().toList()
+ List<RelPeriodeService> relPeriodeServices = RelPeriodeService.findAllByService(service)
+
+ relPeriodeServices.each { RelPeriodeService relPeriodeService ->
+ IntervalleEnum intervalle = intervalles.find { it == relPeriodeService.periode.intervalle }
+ if (intervalle) {
+ relPeriodeService.coeff = coeffMap.get(intervalle)
+ relPeriodeService.save(flush: true)
+ }
+ }
+ }
+
+ /**
+ * Verifie le changement des coefficients
+ * @param service
+ * @param coeff
+ */
+ private void assertCoeff(Service service, BigDecimal coeff) {
+ List<RelPeriodeService> relPeriodeServices = RelPeriodeService.findAllByService(service)
+ relPeriodeServices.each {
+ if (it.periode.typePeriode.nature == NaturePeriode.NOTATION) {
+ assertEquals("Le coefficient n'a pas été appliqué correctement", coeff, it.coeff)
+ }
+ }
+ }
+
+ /**
+ * Verifie le changement des coefficients
+ * @param service
+ * @param coeff
+ */
+ private void assertCoeffs(Service service, Map<IntervalleEnum, BigDecimal> coeffMap) {
+ List<IntervalleEnum> intervalles = coeffMap.keySet().toList()
+ List<RelPeriodeService> relPeriodeServices = RelPeriodeService.findAllByService(service)
+ relPeriodeServices.each { RelPeriodeService relPeriodeService ->
+ IntervalleEnum intervalle = intervalles.find { it == relPeriodeService.periode.intervalle }
+ if (intervalle) {
+ assertEquals(
+ "Le coefficient n'a pas été appliqué correctement",
+ coeffMap.get(intervalle),
+ relPeriodeService.coeff
+ )
+ }
+ }
+ }
+
+ /**
+ * Verifie le changement des coefficients des sous-services
+ * si le coefficient est null, il n'est pas verifie
+ * @param service
+ * @param coefficientEcrit
+ * @param coefficientOral
+ */
+ private void assertCoeffsSousServices(Service service,
+ BigDecimal coefficientEcrit,
+ BigDecimal coefficientOral) {
+ List<RelPeriodeService> relPeriodeServices = RelPeriodeService.findAllByService(service)
+ relPeriodeServices.each { RelPeriodeService relPeriodeService ->
+ if (relPeriodeService.periode.typePeriode.nature == NaturePeriode.NOTATION) {
+ List<SousService> sousServices = service.sousServices.
+ findAll { it.typePeriode.id == relPeriodeService.periode.typePeriode.id }.
+ toList()
+
+ if (coefficientEcrit!=null) {
+ SousService ecrit = sousServices.
+ find { it.modaliteMatiere.code == PopulationTestModaliteMatiere.ECRIT_ETAB1.code }
+ assertEquals(
+ "Le coefficient de sous-service n'a pas été appliqué correctement",
+ coefficientEcrit,
+ ecrit.coeff
+ )
+ }
+ if (coefficientOral!=null) {
+ SousService oral = sousServices.
+ find { it.modaliteMatiere.code == PopulationTestModaliteMatiere.ORAL_ETAB1.code }
+ assertEquals(
+ "Le coefficient de sous-service n'a pas été appliqué correctement",
+ coefficientOral,
+ oral.coeff
+ )
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Verifie le changement de'ordre des sous-services
+ * si le coefficient est null, il n'est pas verifie
+ * @param service
+ * @param ordreEcrit
+ * @param ordreOral
+ */
+ private void assertOrdreSousServices(Service service,
+ Integer ordreEcrit,
+ Integer ordreOral) {
+ List<RelPeriodeService> relPeriodeServices = RelPeriodeService.findAllByService(service)
+ relPeriodeServices.each { RelPeriodeService relPeriodeService ->
+ if (relPeriodeService.periode.typePeriode.nature == NaturePeriode.NOTATION) {
+ List<SousService> sousServices = service.sousServices.
+ findAll { it.typePeriode.id == relPeriodeService.periode.typePeriode.id }.
+ toList()
+
+ if (ordreEcrit!=null) {
+ SousService ecrit = sousServices.
+ find { it.modaliteMatiere.code == PopulationTestModaliteMatiere.ECRIT_ETAB1.code }
+ ecrit.refresh()
+ assertEquals(
+ "L'ordre de sous-service n'a pas été appliqué correctement",
+ ordreEcrit,
+ ecrit.ordre
+ )
+ }
+ if (ordreOral!=null) {
+ SousService oral = sousServices.
+ find { it.modaliteMatiere.code == PopulationTestModaliteMatiere.ORAL_ETAB1.code }
+ oral.refresh()
+ assertEquals(
+ "L'ordre de sous-service n'a pas été appliqué correctement",
+ ordreOral,
+ oral.ordre
+ )
+ }
+ }
+ }
+ }
+
+ /**
+ * Teste le changement d'ordre des serivices
+ */
+ void testOrdre() {
+
+ Integer ordrePortugais = 1;
+ Integer ordreChinois = 2;
+ Integer ordreBasque = 3;
+
+ StructureEnseignement classeSource = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1
+ )
+
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.PORTUGAIS,
+ PopulationTestMatiere.CHINOIS,
+ PopulationTestMatiere.BASQUE
+ ], classeSource)
+
+ StructureEnseignement classeCible = localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1_2
+ )
+
+ initDonneesNotesTestService.creeServices([
+ PopulationTestMatiere.BASQUE,
+ PopulationTestMatiere.CHINOIS,
+ PopulationTestMatiere.PORTUGAIS
+ ], classeCible)
+
+
+ List<Service> servicesSource = Service.findAllByStructureEnseignement(classeSource)
+
+ // il faut l'appeler dans l'ordre croisiant, sinon l'ordre ne va pas etre bien positionne
+ setOrdre(PopulationTestMatiere.PORTUGAIS, ordrePortugais, servicesSource)
+ setOrdre(PopulationTestMatiere.CHINOIS, ordreChinois, servicesSource)
+ setOrdre(PopulationTestMatiere.BASQUE, ordreBasque, servicesSource)
+
+ List<Service> servicesCible = Service.findAllByStructureEnseignement(classeCible)
+
+ prepareTraitements(classeSource, classeCible, servicesCible, true, false, false)
+ reportProprietesService.lanceReportDeProprietes()
+
+ servicesCible = Service.findAllByStructureEnseignement(classeCible)
+ servicesCible.each { service ->
+ service.refresh()
+
+ switch (service.matiere.codeGestion) {
+ case PopulationTestMatiere.PORTUGAIS.codeGestion:
+ assertOrdre(service, ordrePortugais)
+ break;
+
+ case PopulationTestMatiere.CHINOIS.codeGestion:
+ assertOrdre(service, ordreChinois)
+ break;
+
+ case PopulationTestMatiere.BASQUE.codeGestion:
+ assertOrdre(service, ordreBasque)
+ break;
+
+ }
+ }
+ }
+
+ /**
+ * Positionne l'ordre d'un service
+ * @param service
+ * @param ordre
+ */
+ private void setOrdre(Service service, Integer ordre) {
+
+ List<RelPeriodeService> relPeriodeServices =
+ RelPeriodeService.findAllByService(service)
+
+ relPeriodeServices.each {
+ if (it.periode.typePeriode.nature == NaturePeriode.NOTATION) {
+ notesRelPeriodeServiceService.internalChangeOrdre(it, ordre)
+ }
+ }
+ }
+
+ /**
+ * Positionne l'ordre d'un service de matiere donne
+ * @param service
+ * @param ordre
+ */
+ private void setOrdre(PopulationTestMatiere serviceMatiere,
+ Integer ordre,
+ List<Service> services) {
+
+ Service service = services.find { it.matiere.codeGestion == serviceMatiere.codeGestion }
+
+ List<RelPeriodeService> relPeriodeServices =
+ RelPeriodeService.findAllByService(service)
+
+ relPeriodeServices.each {
+ if (it.periode.typePeriode.nature == NaturePeriode.NOTATION) {
+ notesRelPeriodeServiceService.internalChangeOrdre(it, ordre)
+ }
+ }
+ }
+
+ /**
+ * Verifie l'ordre du service
+ * @param service
+ * @param ordre
+ */
+ private void assertOrdre(Service service, Integer ordre) {
+ List<RelPeriodeService> relPeriodeServices =
+ RelPeriodeService.findAllByService(service)
+ relPeriodeServices.each {
+ if (it.periode.typePeriode.nature == NaturePeriode.NOTATION) {
+ assertEquals("L'ordre n'a pas été appliqué correctement", ordre, it.ordre)
+ }
+ }
+ }
+
+ /**
+ * Test de changement des coefficients en appliquant
+ * un service en semestre a un service en trimestre
+ */
+ void testCoeffSemestreTrimestre() {
+
+ BigDecimal coeffS1 = 91
+ BigDecimal coeffS2 = 92
+ BigDecimal coeffAnnee = 99
+ PopulationTestMatiere matiere = PopulationTestMatiere.OCCITAN
+
+ // Service source
+ StructureEnseignement classeSource = localStructureEnseignementService.
+ creeStructureEnseignement(
+ 'TEST-1',
+ StructureEnseignement.TYPE_CLASSE,
+ etablissement,
+ anneeScolaireService.anneeScolaireEnCours(),
+ TypeIntervalleEnum.SEMESTRE)
+
+ initDonneesNotesTestService.creeServices([matiere], classeSource)
+ Service serviceSource = Service.findAllByStructureEnseignement(classeSource).
+ find { it.matiere.codeGestion == matiere.codeGestion }
+
+ setCoeff(serviceSource, [
+ (IntervalleEnum.S1) : coeffS1,
+ (IntervalleEnum.S2) : coeffS2,
+ (IntervalleEnum.ANNEE) : coeffAnnee
+ ])
+
+ // Service cible
+ StructureEnseignement classeCible = localStructureEnseignementService.
+ creeStructureEnseignement(
+ 'TEST-2',
+ StructureEnseignement.TYPE_CLASSE,
+ etablissement,
+ anneeScolaireService.anneeScolaireEnCours(),
+ TypeIntervalleEnum.TRIMESTRE
+ )
+ initDonneesNotesTestService.creeServices([matiere], classeCible)
+ List<Service> servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+
+ // Traitement
+ prepareTraitements(classeSource, classeCible, servicesCibles, false, true, false)
+ reportProprietesService.lanceReportDeProprietes()
+
+ // Verification
+ servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+ Service serviceCible = servicesCibles.
+ find { it.matiere.codeGestion == matiere.codeGestion }
+ serviceCible.refresh()
+ assertCoeffs(serviceCible, [
+ (IntervalleEnum.T1) : coeffS1,
+ (IntervalleEnum.T2) : coeffS2,
+ (IntervalleEnum.T3) : coeffS2,
+ (IntervalleEnum.ANNEE) : coeffAnnee
+ ])
+
+ }
+
+ /**
+ * Test de changement des coefficients en appliquant
+ * un service en trimestre a un service en semestre
+ */
+ void testCoeffTrimestreSemestre() {
+
+ BigDecimal coeffT1 = 81
+ BigDecimal coeffT2 = 82
+ BigDecimal coeffT3 = 83
+ BigDecimal coeffAnnee = 89
+ PopulationTestMatiere matiere = PopulationTestMatiere.OCCITAN
+
+ // Service source
+ StructureEnseignement classeSource = localStructureEnseignementService.
+ creeStructureEnseignement(
+ 'TEST-1',
+ StructureEnseignement.TYPE_CLASSE,
+ etablissement,
+ anneeScolaireService.anneeScolaireEnCours(),
+ TypeIntervalleEnum.TRIMESTRE)
+
+ initDonneesNotesTestService.creeServices([matiere], classeSource)
+ Service serviceSource = Service.findAllByStructureEnseignement(classeSource).
+ find { it.matiere.codeGestion == matiere.codeGestion }
+
+ setCoeff(serviceSource, [
+ (IntervalleEnum.T1) : coeffT1,
+ (IntervalleEnum.T2) : coeffT2,
+ (IntervalleEnum.T3) : coeffT3,
+ (IntervalleEnum.ANNEE) : coeffAnnee
+ ])
+
+ // Service cible
+ StructureEnseignement classeCible = localStructureEnseignementService.
+ creeStructureEnseignement(
+ 'TEST-2',
+ StructureEnseignement.TYPE_CLASSE,
+ etablissement,
+ anneeScolaireService.anneeScolaireEnCours(),
+ TypeIntervalleEnum.SEMESTRE
+ )
+ initDonneesNotesTestService.creeServices([matiere], classeCible)
+ List<Service> servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+
+ // Traitement
+ prepareTraitements(classeSource, classeCible, servicesCibles, false, true, false)
+ reportProprietesService.lanceReportDeProprietes()
+
+ // Verification
+ servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+ Service serviceCible = servicesCibles.
+ find { it.matiere.codeGestion == matiere.codeGestion }
+ serviceCible.refresh()
+ assertCoeffs(serviceCible, [
+ (IntervalleEnum.S1) : coeffT1,
+ (IntervalleEnum.S2) : coeffT2,
+ (IntervalleEnum.ANNEE) : coeffAnnee
+ ])
+
+ }
+
+ /**
+ * Test de report des sous-services
+ */
+ void testReportSousServices() {
+
+ PopulationTestMatiere matiere1 = PopulationTestMatiere.OCCITAN
+ PopulationTestMatiere matiere2 = PopulationTestMatiere.ALSACIEN
+ PopulationTestMatiere matiere3 = PopulationTestMatiere.BRETON
+
+ // Service source
+ StructureEnseignement classeSource = localStructureEnseignementService.
+ creeStructureEnseignement(
+ 'TEST-1',
+ StructureEnseignement.TYPE_CLASSE,
+ etablissement,
+ anneeScolaireService.anneeScolaireEnCours(),
+ TypeIntervalleEnum.TRIMESTRE)
+
+ initDonneesNotesTestService.creeServices(
+ [
+ matiere1,
+ matiere2,
+ matiere3
+ ],
+ classeSource
+ )
+
+ Service serviceSource1SansSS = getService(classeSource, matiere1)
+ Service serviceSource2AvecSS = getService(classeSource, matiere2)
+ Service serviceSource3AvecSS = getService(classeSource, matiere3)
+
+ SousServicesParametres parametresServiceSource1 = new SousServicesParametres()
+ SousServicesParametres parametresServiceSource2 = new SousServicesParametres(
+ ecritCoefficient: 1,
+ ecritEvaluable: true,
+ ecritOrdre: 1,
+ oralCoefficient: 2,
+ oralEvaluable: false,
+ oralOrdre: 2
+ )
+ SousServicesParametres parametresServiceSource3 = new SousServicesParametres(
+ ecritCoefficient: 3,
+ ecritEvaluable: false,
+ ecritOrdre: 1,
+ oralCoefficient: 3,
+ oralEvaluable: true,
+ oralOrdre: 2
+ )
+
+ attacheSousServices(serviceSource2AvecSS, parametresServiceSource2)
+ // 1. Ecrit, evaluable, coeff 1
+ // 2. Oral, non-evaluable, coeff 2
+ attacheSousServices(serviceSource3AvecSS, parametresServiceSource3)
+ // 1. Ecrit, non-evaluable, coeff 3
+ // 2. Oral, evaluable, coeff 3
+
+ // Service cible
+ StructureEnseignement classeCible = localStructureEnseignementService.
+ creeStructureEnseignement(
+ 'TEST-2',
+ StructureEnseignement.TYPE_CLASSE,
+ etablissement,
+ anneeScolaireService.anneeScolaireEnCours(),
+ TypeIntervalleEnum.TRIMESTRE
+ )
+ initDonneesNotesTestService.creeServices([
+ matiere1,
+ matiere2,
+ matiere3
+ ], classeCible)
+ List<Service> servicesCibles = Service.findAllByStructureEnseignement(classeCible)
+
+ Service serviceCible1AvecSS = getService(classeCible, matiere1)
+ Service serviceCible2SansSS = getService(classeCible, matiere2)
+ Service serviceCible3AvecUnSS = getService(classeCible, matiere3)
+
+ SousServicesParametres parametresServiceCible1 = new SousServicesParametres(
+ ecritCoefficient: 1,
+ ecritEvaluable: true,
+ ecritOrdre: 2,
+ oralCoefficient: 2,
+ oralEvaluable: false,
+ oralOrdre: 2
+ )
+ SousServicesParametres parametresServiceCible2 = new SousServicesParametres()
+ SousServicesParametres parametresServiceCible3 = new SousServicesParametres(
+ ecritCoefficient: null,
+ ecritEvaluable: null,
+ ecritOrdre: null,
+ oralCoefficient: 2,
+ oralEvaluable: true,
+ oralOrdre: 1
+ )
+
+ attacheSousServices(serviceCible1AvecSS, parametresServiceCible1)
+ // 1. Ecrit, evaluable, coeff 1
+ // 2. Oral, non-evaluable, coeff 2
+ attacheSousServices(serviceCible3AvecUnSS, parametresServiceCible3)
+ // 1. Oral, evaluable, coeff 2
+
+ // Traitement
+ prepareTraitements(classeSource, classeCible, servicesCibles, false, false, true)
+ reportProprietesService.lanceReportDeProprietes()
+
+ // Verification
+ verifieRienChange(serviceCible1AvecSS, parametresServiceSource1, parametresServiceCible1)
+ verifieSousServicesAjoutes(serviceCible2SansSS, parametresServiceSource2, parametresServiceCible2)
+ verifieEcritAjoute(serviceCible3AvecUnSS, parametresServiceSource3, parametresServiceCible3)
+
+ }
+
+ /**
+ * Verifie que rien n'a change ce qui concerne les sous-services du service cible.
+ * Cas ou le service source n'a pas des sous-services et le service cible les a.
+ * @param serviceCible
+ */
+ void verifieRienChange(Service serviceCible,
+ SousServicesParametres parametresSource,
+ SousServicesParametres parametresCible) {
+ verifieSousServices(
+ serviceCible,
+ parametresCible.ecritCoefficient,
+ parametresCible.ecritEvaluable,
+ parametresCible.ecritOrdre,
+ parametresCible.oralCoefficient,
+ parametresCible.oralEvaluable,
+ parametresCible.oralOrdre
+ )
+ }
+
+ /**
+ * Verifie que les sous-services ont ete ajoutes au service cible.
+ * Cas ou le service source a des sous-services et le service cible ne les a pas.
+ * @param serviceCible
+ */
+ void verifieSousServicesAjoutes(Service serviceCible,
+ SousServicesParametres parametresSource,
+ SousServicesParametres parametresCible) {
+ verifieSousServices(
+ serviceCible,
+ parametresSource.ecritCoefficient,
+ parametresSource.ecritEvaluable,
+ parametresSource.ecritOrdre,
+ parametresSource.oralCoefficient,
+ parametresSource.oralEvaluable,
+ parametresSource.oralOrdre
+ )
+ }
+
+ /**
+ * Verifie que le sous-service d'ecrit a ete ajoute au service cible et
+ * que le sous-service oral n'a pas change.
+ * Cas ou le service source a un sous-service en plus (Ecrit) et
+ * un sous-service qui existe deja dans le service cible (Oral).
+ * @param serviceCible
+ */
+ void verifieEcritAjoute(Service serviceCible,
+ SousServicesParametres parametresSource,
+ SousServicesParametres parametresCible) {
+ verifieSousServices(
+ serviceCible,
+ parametresSource.ecritCoefficient,
+ parametresSource.ecritEvaluable,
+ 2, //mis apres le sous-service existant
+ parametresCible.oralCoefficient, // oral garde ses params originals
+ parametresCible.oralEvaluable, // oral garde ses params originals
+ parametresCible.oralOrdre // oral reste tjs premier
+ )
+ }
+
+ /**
+ * Verifie les sous-services Ecrit et Oral de service pour les periodes de notation
+ */
+ private void verifieSousServices(Service service,
+ BigDecimal ecritCoefficient,
+ Boolean ecritEvaluable,
+ Integer ecritOrdre,
+ BigDecimal oralCoefficient,
+ Boolean oralEvaluable,
+ Integer oralOrdre
+ ) {
+
+ service.refresh()
+
+ Integer countEcrit = 0 // nombre de sous-services Ecrit
+ Integer countOral = 0 // nombre de sous-services Oral
+
+ service.sousServices.findAll { it.typePeriode.isNotation() }.each {
+ if (it.modaliteMatiere.libelle == PopulationTestModaliteMatiere.ECRIT_ETAB1.libelle) {
+ countEcrit++
+ assertEquals("Coefficient de sous-service a change", it.coeff, ecritCoefficient)
+ assertEquals("Evaluabilite de sous-service a change", it.evaluable, ecritEvaluable)
+ assertEquals("Ordre de sous-service a change", it.ordre, ecritOrdre)
+ }
+ if (it.modaliteMatiere.libelle == PopulationTestModaliteMatiere.ORAL_ETAB1.libelle) {
+ countOral++
+ assertEquals("Coefficient de sous-service a change", it.coeff, oralCoefficient)
+ assertEquals("Evaluabilite de sous-service a change", it.evaluable, oralEvaluable)
+ assertEquals("Ordre de sous-service a change", it.ordre, oralOrdre)
+ }
+ }
+
+ // un sous-service pour chaque typeDePeriode de notation - t1, t2, t3, annee
+ assertEquals("Le nombre de sous-services n'est pas correct", 4, countEcrit)
+ assertEquals("Le nombre de sous-services n'est pas correct", 4, countOral)
+ }
+
+ /**
+ * Cherche service de classe par matiere
+ * @param structureEnseignement
+ * @param populationTestMatiere
+ * @return
+ */
+ Service getService(StructureEnseignement classe,
+ PopulationTestMatiere populationTestMatiere) {
+ return Service.findAllByStructureEnseignement(classe).
+ find { it.matiere.codeGestion == populationTestMatiere.codeGestion }
+ }
+
+ protected void tearDown() {
+ super.tearDown()
+ }
+
+}
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot.notes
+
+import grails.test.GrailsUnitTestCase
+import org.lilie.services.eliot.notes.domaine.ReportParams
+import org.lilie.services.eliot.notes.report.ReportService
+import org.lilie.services.eliot.notes.report.ReportTraitementService
+
+import javax.sql.DataSource
+
+import org.lilie.services.eliot.scolarite.*
+import org.lilie.services.eliot.test.*
+
+/**
+ * ReportService
+ * @author msan
+ */
+class ReportServiceTests extends GrailsUnitTestCase{
+
+ ReportService reportService
+
+ DataSource dataSource
+
+ LocalInitDonneesCommunesTestService localInitDonneesCommunesTestService
+
+ protected void setUp() {
+ super.setUp()
+ }
+
+ private Etablissement initData(){
+ // set de l'établissement courant
+ Etablissement etablissement = localInitDonneesCommunesTestService.getEtablissement(
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ )
+
+ StructureEnseignement classeSource =
+ localInitDonneesCommunesTestService.
+ getClasse(PopulationTestClasse.CLASSE_1_2)
+
+ // récupération d'une classe cible dans l'établissement courant
+ StructureEnseignement structureEnseignementEtabCourant =
+ localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1
+ )
+ // récupération d'une classe cible d'un autre établissement
+ StructureEnseignement structureEnseignement =
+ localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_2
+ )
+ Service serviceCible1 = localInitDonneesCommunesTestService.getService(
+ PopulationTestActeur.ENSEIGNANT_1,
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestClasse.CLASSE_1,
+ PopulationTestMatiere.ANGLAIS
+ )
+ Service serviceCible2 = localInitDonneesCommunesTestService.getService(
+ PopulationTestActeur.ENSEIGNANT_2,
+ PopulationTestActeur.DIRECTION_2,
+ PopulationTestClasse.CLASSE_2,
+ PopulationTestMatiere.MATHEMATIQUES_ETAB2
+ )
+
+ Report report = reportService.creeReport(
+ etablissement,
+ new ReportParams(
+ classeSource: classeSource,
+ naturePeriode: NaturePeriode.NOTATION,
+ typePeriode: null,
+ sousMatieres: true,
+ ordreMatieres: true,
+ coefficients: true
+ ))
+
+ // création des ReportTraitement
+ ReportTraitement traitementReport1 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.EN_ATTENTE
+ )
+ ReportTraitement traitementReport2 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.EN_ATTENTE
+ )
+ ReportTraitement traitementReport3 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.EN_COURS
+ )
+ ReportTraitement traitementReport4 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.EN_COURS
+ )
+ ReportTraitement traitementReport5 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.ERREUR
+ )
+ ReportTraitement traitementReport6 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.ERREUR
+ )
+ ReportTraitement traitementReport7 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.TERMINE
+ )
+ ReportTraitement traitementReport8 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.TERMINE
+ )
+ traitementReport1.save()
+ traitementReport2.save()
+ traitementReport3.save()
+ traitementReport4.save()
+ traitementReport5.save()
+ traitementReport6.save()
+ traitementReport7.save()
+ traitementReport8.save()
+
+ return etablissement
+ }
+
+ void testSupprimeReports(){
+ Etablissement etablissementCourant = initData()
+
+ def nbOfTraitementReportBefore = ReportTraitement.count()
+ def nbOfTraitementReportBeforeEtabCourant =
+ ReportTraitement.createCriteria().list{
+ classeCible{
+ eq('etablissement.id', etablissementCourant?.id)
+ }
+ }?.size()
+
+ assertTrue("La table entdemon.report_options devrait contenir au moins 8 lignes",
+ nbOfTraitementReportBefore >= 8)
+ assertTrue("""La table entdemon.report_options devrait contenir au moins 4 lignes
+ dont la classe cible fait partie de l'établissement $etablissementCourant""",
+ nbOfTraitementReportBeforeEtabCourant >= 4)
+
+ // Méthode testée
+ reportService.supprimeReport(etablissementCourant)
+
+ // Vérifications
+ def nbOfTraitementReportAfterEtabCourant =
+ ReportTraitement.createCriteria().list{
+ classeCible{
+ eq('etablissement.id', etablissementCourant?.id)
+ }
+ }?.size()
+
+ assertEquals(
+ "Les reportTraitements de l'etablissement courant devrait etre supprimes",
+ 0,
+ nbOfTraitementReportAfterEtabCourant
+ )
+ assertEquals(
+ "Les reports de l'etablissement courant devrait etre supprimes",
+ 0,
+ Report.count()
+ )
+ }
+
+ protected void tearDown() {
+ super.tearDown()
+ }
+}
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot.notes
+
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.test.PopulationTestClasse
+import org.lilie.services.eliot.test.PopulationTestActeur
+import org.lilie.services.eliot.test.PopulationTestMatiere
+import org.lilie.services.eliot.test.PopulationTestEtablissement
+import org.lilie.services.eliot.test.LocalInitDonneesCommunesTestService
+import org.lilie.services.eliot.scolarite.Etablissement
+
+import grails.test.GrailsUnitTestCase
+
+import javax.sql.DataSource
+import org.lilie.services.eliot.notes.report.ReportTraitementService
+import org.lilie.services.eliot.notes.report.ReportService
+import org.lilie.services.eliot.notes.domaine.ReportParams
+import org.lilie.services.eliot.scolarite.NaturePeriode
+import org.lilie.services.eliot.scolarite.TypePeriode
+
+/**
+ * ReportTraitementService
+ * @author agia
+ * @author msan
+ */
+class ReportTraitementServiceTests extends GrailsUnitTestCase{
+
+ ReportTraitementService reportTraitementService
+ ReportService reportService
+
+ DataSource dataSource
+
+ LocalInitDonneesCommunesTestService localInitDonneesCommunesTestService
+
+ protected void setUp() {
+ super.setUp()
+ }
+
+ private Etablissement initData(){
+ // set de l'établissement courant
+ Etablissement etablissement = localInitDonneesCommunesTestService.getEtablissement(
+ PopulationTestEtablissement.ETABLISSEMENT_1
+ )
+
+ StructureEnseignement classeSource =
+ localInitDonneesCommunesTestService.
+ getClasse(PopulationTestClasse.CLASSE_1_2)
+
+ // récupération d'une classe cible dans l'établissement courant
+ StructureEnseignement structureEnseignementEtabCourant =
+ localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_1
+ )
+ // récupération d'une classe cible d'un autre établissement
+ StructureEnseignement structureEnseignement =
+ localInitDonneesCommunesTestService.getClasse(
+ PopulationTestClasse.CLASSE_2
+ )
+ Service serviceCible1 = localInitDonneesCommunesTestService.getService(
+ PopulationTestActeur.ENSEIGNANT_1,
+ PopulationTestActeur.DIRECTION_1,
+ PopulationTestClasse.CLASSE_1,
+ PopulationTestMatiere.ANGLAIS
+ )
+ Service serviceCible2 = localInitDonneesCommunesTestService.getService(
+ PopulationTestActeur.ENSEIGNANT_2,
+ PopulationTestActeur.DIRECTION_2,
+ PopulationTestClasse.CLASSE_2,
+ PopulationTestMatiere.MATHEMATIQUES_ETAB2
+ )
+
+ Report report = reportService.creeReport(
+ etablissement,
+ new ReportParams(
+ classeSource: classeSource,
+ naturePeriode: NaturePeriode.NOTATION,
+ typePeriode: null,
+ sousMatieres: true,
+ ordreMatieres: true,
+ coefficients: true
+ ))
+
+ // création des ReportTraitement
+ ReportTraitement traitementReport1 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.EN_ATTENTE
+ )
+ ReportTraitement traitementReport2 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.EN_ATTENTE
+ )
+ ReportTraitement traitementReport3 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.EN_COURS
+ )
+ ReportTraitement traitementReport4 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.EN_COURS
+ )
+ ReportTraitement traitementReport5 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.ERREUR
+ )
+ ReportTraitement traitementReport6 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.ERREUR
+ )
+ ReportTraitement traitementReport7 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignement,
+ serviceCible : serviceCible2,
+ etat : ReportTraitementEtat.TERMINE
+ )
+ ReportTraitement traitementReport8 = new ReportTraitement (
+ report : report,
+ classeCible : structureEnseignementEtabCourant,
+ serviceCible : serviceCible1,
+ etat : ReportTraitementEtat.TERMINE
+ )
+ traitementReport1.save()
+ traitementReport2.save()
+ traitementReport3.save()
+ traitementReport4.save()
+ traitementReport5.save()
+ traitementReport6.save()
+ traitementReport7.save()
+ traitementReport8.save()
+
+ return etablissement
+ }
+
+ /**
+ * Test de suppression des ReportTraitements en_attente de l'etablissement courant
+ */
+ void testSupprimeReportsEnAttente() {
+ Etablissement etablissement = initData()
+
+ def nbOfTraitementReportBefore = ReportTraitement.count()
+ def nbOfTraitementReportBeforeEtabCourantEnAttente =
+ ReportTraitement.createCriteria().list{
+ classeCible{
+ eq('etablissement.id', etablissement?.id)
+ }
+ eq('etat', ReportTraitementEtat.EN_ATTENTE)
+ }?.size()
+
+ assertTrue("La table entnotes.report_traitement devrait contenir au moins 8 lignes",
+ nbOfTraitementReportBefore >= 8)
+ assertTrue("""La table entnotes.report_traitement devrait contenir au moins 1 lignes
+ en attente et dont la classe cible fait partie de l'établissement $etablissement""",
+ nbOfTraitementReportBeforeEtabCourantEnAttente >= 1)
+
+ // Méthode testée
+ reportTraitementService.supprimeReportsTraitementEnAttente(etablissement)
+
+ // Vérifications
+ def nbOfTraitementReportAfter = ReportTraitement.count()
+
+ assertTrue("La table entnotes.report_traitement devrait contenir 1 lignes de moins",
+ nbOfTraitementReportAfter == nbOfTraitementReportBefore - nbOfTraitementReportBeforeEtabCourantEnAttente)
+ }
+
+ protected void tearDown() {
+ super.tearDown()
+ }
+}
--- /dev/null
+package org.lilie.services.eliot.notes
+
+/**
+ * Parametres de sous-services par defaut
+ * @author msan
+ */
+class SousServicesParametres {
+
+ BigDecimal ecritCoefficient = null
+ Boolean ecritEvaluable = null
+ Integer ecritOrdre = null
+
+ BigDecimal oralCoefficient = null
+ Boolean oralEvaluable = null
+ Integer oralOrdre = null
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot.notes.report
+
+import grails.plugin.spock.UnitSpec
+import org.lilie.services.eliot.scolarite.Matiere
+import org.lilie.services.eliot.scolarite.Service
+import org.lilie.services.eliot.scolarite.Enseignement
+import org.lilie.services.eliot.securite.impl.Autorite
+
+/**
+ * @author onic
+ */
+class ReportProprietesServiceSpec extends UnitSpec {
+
+ ReportProprietesService reportProprietesService
+
+ Matiere matiereMath
+ Matiere matiereFrancais
+
+ Autorite enseignant1
+ Autorite enseignant2
+
+ Service serviceCible
+
+ def setup() {
+ reportProprietesService = new ReportProprietesService()
+
+ matiereMath = new Matiere()
+ matiereFrancais = new Matiere()
+
+ enseignant1 = new Autorite(idExterne: 'enseignant 1')
+ enseignant2 = new Autorite(idExterne: 'enseignant 2')
+
+ serviceCible = new Service(
+ matiere: matiereMath,
+ enseignements: [new Enseignement(
+ enseignant: enseignant1
+ )]
+ )
+ }
+
+ /**
+ * On prend la matière du service de la classe de destination.
+ * On compare la matière avec celles des services de la classe de référence.
+ *
+ * => Cas 1 : matière trouvée avec un seul service dans la classe de référence
+ * => on applique les paramètres du service de la classe de référence
+ * au service de la classe de destination.
+ */
+ def 'cherche service source correspondant : cas 1'() {
+ setup:
+ Service serviceMath = new Service(matiere: matiereMath)
+ Service serviceFrancais = new Service(matiere: matiereFrancais)
+
+ List<Service> servicesSource = [serviceFrancais, serviceMath]
+ when:
+ Service serviceSource = reportProprietesService
+ .chercheServiceSourceCorrespondant(serviceCible, servicesSource)
+ then:
+ serviceSource == serviceMath
+ }
+
+ /**
+ * => Cas 2 : matière trouvée avec plusieurs services dans la classe de référence
+ * => on recherche le service dans la classe de référence avec le même
+ * professeur que celui de la classe de destination.
+ * => Cas 1 : on ne trouve pas le service matière + prof dans la
+ * classe de référence => aucun traitement.
+ */
+ def 'cherche service source correspondant : cas 2-1' () {
+ setup:
+ Service serviceMath1 = new Service(
+ matiere: matiereMath,
+ enseignements: [new Enseignement(
+ enseignant: enseignant2
+ )]
+ )
+
+ Service serviceMath2 = new Service(
+ matiere: matiereMath,
+ enseignements: [new Enseignement(
+ enseignant: enseignant2
+ )]
+ )
+
+ Service serviceFrancais = new Service(matiere: matiereFrancais)
+
+ List<Service> servicesSource = [serviceFrancais, serviceMath1, serviceMath2]
+ when:
+ Service serviceSource = reportProprietesService
+ .chercheServiceSourceCorrespondant(serviceCible, servicesSource)
+ then:
+ serviceSource == null
+
+ }
+
+ /**
+ * => Cas 2 : matière trouvée avec plusieurs services dans la classe de référence
+ * => on recherche le service dans la classe de référence avec le même
+ * professeur que celui de la classe de destination.
+ * => Cas 2 : on trouve le service matière + prof => on applique
+ * les paramètres du service de la classe de référence
+ * au service de la classe de destination.
+ */
+ def 'cherche service source correspondant : cas 2-2'() {
+ setup:
+ Service serviceMath1 = new Service(
+ matiere: matiereMath,
+ enseignements: [new Enseignement(
+ enseignant: enseignant1
+ )]
+ )
+
+ Service serviceMath2 = new Service(
+ matiere: matiereMath,
+ enseignements: [new Enseignement(
+ enseignant: enseignant2
+ )]
+ )
+
+ Service serviceFrancais = new Service(matiere: matiereFrancais)
+
+ List<Service> servicesSource = [serviceFrancais, serviceMath1, serviceMath2]
+ when:
+ Service serviceSource = reportProprietesService
+ .chercheServiceSourceCorrespondant(serviceCible, servicesSource)
+ then:
+ serviceSource == serviceMath1
+
+ }
+
+ /**
+ * => Cas 3 : matière non trouvée => aucun traitement.
+ *
+ * - Pour les services avec plusieurs professeurs, on tient compte uniquement
+ * du 1er professeur trouvé, que ce soit pour la classe de référence
+ * ou de destination.
+ *
+ * - On ne tient pas compte de l'information service classe ou groupe.
+ */
+ def 'cherche service source correspondant : cas 3' () {
+ setup:
+ Service serviceFrancais1 = new Service(matiere: matiereFrancais)
+ Service serviceFrancais2 = new Service(matiere: matiereFrancais)
+
+ List<Service> servicesSource = [serviceFrancais1, serviceFrancais2]
+ when:
+ Service serviceSource = reportProprietesService
+ .chercheServiceSourceCorrespondant(serviceCible, servicesSource)
+ then:
+ serviceSource == null
+
+ }
+
+}
var Clazz = Ext.extend(Ext.util.Observable, {
constructor: function() {
+ this.init(eliot.notes.parametrages.services);
- // supprime le loadMask après un temps maximal
- eliot.notes.commun.Utils.supprimeLoadMask();
+ if (this.isAfficheTraitementEnCours() == true) {
+ this.creeItemsTraitementEnCours();
+ }
+ else {
+ this.creeItemsParametrageService();
+ }
- this.ns = eliot.notes.parametrages.services;
+ },
+
+ init: function(ns) {
+ this.ns = ns;
this.ConfigServeur = this.ns.ConfigServeur;
this.Constantes = this.ns.Constantes;
+ },
+
+ isAfficheTraitementEnCours: function() {
+ return this.ConfigServeur.data.traitementEnCours.traitements != null;
+ },
+
+ creeItemsParametrageService: function() {
+ // supprime le loadMask après un temps maximal
+ eliot.notes.commun.Utils.supprimeLoadMask();
// Création du modèle
this.serviceModel = new this.ns.ServiceModel();
// Supprime la progresse barre
eliot.notes.commun.Utils.supprimeLoadMask(1);
-
// Rendu du viewport
Ext.onReady(function() {
eliot.layout.doLayout(
'idNorthPanel',
'idCenterPanel',
centerRegionItems
- );
+ );
+ });
+ },
+
+ creeItemsTraitementEnCours: function() {
+
+ var controller = new this.ns.TraitementEnCoursController({}).getInterface();
+
+ var view = new this.ns.TraitementEnCoursView({
+ controller: controller
+ }).getInterface();
+
+ var toolbarView = new this.ns.TraitementEnCoursToolbarView({
+ controller: controller
+ }).getInterface();
+
+ controller.observeViews({
+ view: view,
+ toolbarView: toolbarView
});
+ var centerRegionItems = [
+ {
+ xtype:'panel',
+ layout:'border',
+ border: false,
+ autoScroll: true,
+ autoShow: true,
+ items:[
+ {
+ region: 'north',
+ height: 45,
+ border: false,
+ frame: false,
+ layout:'border',
+ items: [
+ {
+ region: 'center',
+ cls:'x-panel-mc',
+ border: true,
+ frame: false,
+ layout:'column',
+ bodyStyle:'padding:1px 25px 5px',
+ items: [
+ {
+ width: 230,
+ layout: 'form',
+ border: false,
+ frame: false,
+ labelWidth : 40,
+ items: view.getComboboxClasse()
+ },
+ {
+ width: 280,
+ layout: 'form',
+ border: false,
+ frame: false,
+ items: view.getComboboxNaturePeriode()
+ },
+ {
+ width: 230,
+ layout: 'form',
+ border: false,
+ frame: false,
+ labelWidth : 40,
+ items: view.getComboboxTypePeriode()
+ }
+ ]
+ },
+ {
+ region: 'south',
+ height: 10,
+ border: true,
+ frame: false
+ }
+ ]
+ },
+ {
+ region: 'center',
+ xtype: 'panel',
+ layout:'border',
+ frame: false,
+ items:[
+ {
+ region: 'north',
+ height: 35,
+ border: false,
+ frame: false,
+ items: toolbarView.getItems()
+ },
+ {
+ region: 'center',
+ xtype: 'panel',
+ border: false,
+ frame: false,
+ layout: 'fit',
+ items: view.getItems()
+ }
+ ]
+ }
+ ]
+ }
+ ];
+
+ // Supprime la progresse barre
+ eliot.notes.commun.Utils.supprimeLoadMask(1);
+
+ // Rendu du viewport
+ Ext.onReady(function() {
+ eliot.layout.doLayout(
+ 'idViewport',
+ 'idNorthPanel',
+ 'idCenterPanel',
+ centerRegionItems
+ );
+
+ if (controller.isTermine() == true) {
+ eliot.notes.Messages.showAvertissement(
+ this.ConfigServeur.messages.finTraitementMsg);
+ }
+ else {
+ eliot.notes.Messages.showAvertissement(
+ this.ConfigServeur.messages.traitementEnCoursMsg);
+ }
+ }, this);
},
/**
];
}
-
});
// Construit l'instance singleton
confirmationModificationNonEvaluableAvecModaliteMatiere: undefined,
confirmationCreationSousMatierePourRegroupement: undefined,
- confirmationModificationSousMatierePourRegroupement: undefined
+ confirmationModificationSousMatierePourRegroupement: undefined,
+
+ enCoursAppliqueA: undefined,
+ confirmationAppliqueA: undefined,
+ erreurAppliqueA: undefined,
+
+ erreurListeClassesAppliqueA: undefined,
+
+ avertissementAppliquerA: undefined,
+
+ erreurValider: undefined,
+ erreurInterrompre: undefined,
+ traitementEnCoursMsg: undefined,
+ finTraitementMsg: undefined
+
},
url:{
urlCreerSousMatiere: undefined,
urlModifierSousMatiere: undefined,
- urlSupprimerSousMatiere: undefined
+ urlSupprimerSousMatiere: undefined,
+ urlListeClassesAppliqueA: undefined,
+ urlAppliqueA: undefined,
+
+ valide: undefined,
+ interromps: undefined
},
libelle: {
+ ok: undefined,
+ annuler: undefined,
+
ordre :undefined,
coeff : undefined,
lblMatiere: undefined,
non: undefined,
servicesEvaluables: undefined,
- servicesNonEvaluables: undefined
+ servicesNonEvaluables: undefined,
+
+ appliquerA: undefined,
+
+ selectionParams: undefined,
+ paramAppliqueA: undefined, // 'Sélection des paramétrages des matières communes à appliquer'
+ classesAModifier: undefined, // 'Classes à modifier'
+
+ ordreMatieres: undefined,
+ coefficients: undefined,
+ sousMatieres: undefined,
+
+ actualiser: undefined,
+ valider: undefined,
+ interrompre: undefined,
+ classe: undefined,
+ statut: undefined
},
icon : {
creation: undefined,
modification: undefined,
suppression: undefined,
- impression: undefined
+ impression: undefined,
+
+ actualiser: undefined,
+ valide: undefined,
+ interrompre: undefined
},
data : {
modaliteMatieres: [],
enseignants: [],
structures: [],
- fermerGroupeNonEvaluable: undefined
+ fermerGroupeNonEvaluable: undefined,
+ traitementEnCours: undefined
},
type: {
actionCreerService: 'actionCreerService',
actionCreerLienSousMatiere: 'actionCreerLienSousMatiere',
actionModifier: 'actionModifier',
- actionSupprimer: 'actionSupprimer'
+ actionSupprimer: 'actionSupprimer',
+ actionAppliqueA: 'actionAppliqueA',
+ openWindowAppliqueA: 'openWindowAppliqueA',
+ appliqueA: 'appliqueA'
},
composantId: {
idBoutonCreerService: 'idBoutonCreerService',
idBoutonCreerLienSousMatiere: 'idBoutonCreerLienSousMatiere',
- idToolbarPanel: 'idToolbarPanel'
+ idToolbarPanel: 'idToolbarPanel',
+ idBoutonPlusDActions : 'idBoutonPlusDActions'
},
storeId:{
+ },
+
+ etat: {
+ termine: 'TERMINE',
+ erreur: 'ERREUR'
}
};
\ No newline at end of file
* Edite un service ou une sous matière
* @event actionEditItem
*/
- this.Constantes.eventId.actionEditItem
+ this.Constantes.eventId.actionEditItem,
+ /**
+ * Ouvre la fenêtre Applique A
+ * @param classe origine
+ * @param classes cibles potentielles
+ */
+ this.Constantes.eventId.openWindowAppliqueA
- );
+ );
// Store Service
this.initStoreService();
this
);
+ view.addListener(
+ this.Constantes.eventId.appliqueA,
+ function(ordre, coefficients, sousMatieres, classes) {
+ this.appliqueA(ordre, coefficients, sousMatieres, classes);
+ },
+ this);
+
+
},
/**
},
this
);
+
+ toolbarView.addListener(
+ this.Constantes.eventId.actionAppliqueA,
+ function() {
+ eliot.notes.Messages.resetMessages();
+ this.actionAppliqueA();
+ },
+ this
+ );
+
},
/**
maskText: this.ConfigServeur.messages.supprimeEnCours,
scope: this
});
+ },
+ /**
+ * Applique le paramétrage à d'autres périodes
+ */
+ actionAppliqueA: function() {
+
+ // Cherche la liste des classes
+ this.getListeClasse(function(reponse) {
+ this.fireEvent(this.Constantes.eventId.openWindowAppliqueA, this.classe, reponse.classes);
+ });
+ },
+ /**
+ * Liste des classes sur lesquelles appliquer le paramétrage
+ * @param success
+ */
+ getListeClasse: function(success) {
+
+ var periodeExamenId =
+ this.periodeModel.getPeriodeExamen() ? this.periodeModel.
+ getPeriodeExamen().id : null;
+
+ eliot.commun.AjaxHelper.request({
+ url: this.ConfigServeur.url.urlListeClassesAppliqueA,
+
+ params: {
+ classeId: this.ConfigServeur.data.classe.id,
+ naturePeriode: this.ConfigServeur.data.nature.id,
+ typePeriodeId: periodeExamenId
+ },
+
+ scope: this,
+
+ success: success,
+
+ failure: function(reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.notes.Messages.showErreur(reponse.message);
+ }
+ else {
+ eliot.notes.Messages.showErreur(this.ConfigServeur.messages.erreurListeClassesAppliqueA);
+ }
+ }
+ });
+ },
+ /**
+ * Applique le paramétrage
+ * @param ordre
+ * @param coefficients
+ * @param sousMatieres
+ * @param classes
+ */
+ appliqueA: function(ordre, coefficients, sousMatieres, classes) {
+
+ var classesParam = [];
+
+ Ext.each(classes, function(classe) {
+ classesParam.push(classe.id);
+ }, this);
+
+ var periodeExamenId =
+ this.periodeModel.getPeriodeExamen() ? this.periodeModel.
+ getPeriodeExamen().id : null;
+
+
+ eliot.commun.AjaxHelper.request({
+
+ url: this.ConfigServeur.url.urlAppliqueA,
+
+ params: {
+ classeId: this.ConfigServeur.data.classe.id,
+ naturePariode: this.ConfigServeur.data.nature.id,
+ typePeriodeId: periodeExamenId,
+ ordreMatieres: ordre,
+ coefficients: coefficients,
+ sousMatieres: sousMatieres,
+ classes: Ext.encode(classesParam)
+ },
+
+ maskText: this.ConfigServeur.messages.enCoursAppliqueA,
+ scope: this,
+ timeout: 60 * 1000,
+
+ success: function() {
+
+ var typePeriodeIdParam = '';
+ if (periodeExamenId != null) {
+ typePeriodeIdParam = '&typePeriodeId=' + periodeExamenId;
+ }
+
+ window.location = this.ConfigServeur.url.urlPage
+ + '?idClasse=' + this.ConfigServeur.data.classe.id
+ + '&nature=' + this.ConfigServeur.data.nature.id
+ + typePeriodeIdParam;
+
+ },
+
+ failure: function(reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.notes.Messages.showErreur(reponse.message);
+ }
+ else {
+ eliot.notes.Messages.showErreur(this.ConfigServeur.messages.erreurAppliqueA);
+ }
+ }
+ });
}
+
+
+
});
this
);
+ controller.addListener(
+ this.Constantes.eventId.openWindowAppliqueA,
+ function(classe, classes) {
+ this.openWindowAppliqueA(classe, classes);
+ },
+ this
+ );
+
+ },
+ /**
+ * Ouvre la fenêtre popup Applique à
+ * @param classe
+ * @param classes
+ */
+ openWindowAppliqueA: function(classe, classes) {
+
+ if (this.windowAppliqueA === undefined) {
+ this.initWindowAppliqueA(classe);
+ }
+
+ this.classes = classes;
+ var localClasses = [
+ {id: undefined, code: '< Toutes >'}
+ ];
+
+ Ext.each(classes, function(classe) {
+ localClasses.push(classe);
+ }, this);
+
+ this.gridClassesWindowAppliqueA.store.loadData({
+ classes: localClasses
+ });
+
+ this.windowAppliqueA.show();
+
+ this.gridClassesWindowAppliqueA.getSelectionModel().selectRow(0);
+ this.checkBoxOrdre.setValue(false);
+ this.checkBoxCoefficients.setValue(false);
+ this.checkBoxSousMatieres.setValue(false);
+
},
/**
var item = this.serviceModel.getItemSelectionne();
var rowIndex = this.serviceGrid.store.indexOf(item);
this.editor.startEditing(rowIndex, true);
+ },
+ /**
+ * Crée la popup Applique a
+ * @param classe
+ */
+ initWindowAppliqueA: function(classe) {
+
+ this.gridClassesWindowAppliqueA = new Ext.grid.GridPanel({
+ store: new Ext.data.Store({
+ autoDestroy: true,
+ reader: new Ext.data.JsonReader({
+ root: 'classes',
+ idProperty: 'id',
+ fields:[
+ {name: 'id'},
+ {name: 'code'}
+ ]
+ })
+ }),
+ colModel: new Ext.grid.ColumnModel({
+ columns: [
+ {dataIndex: 'code', width: 110}
+ ]
+ }),
+ width: 130,
+ height: 100,
+ hideHeaders: true,
+ autoSize: false,
+ border: false,
+ cls: 'portal-default_table',
+ listeners: {
+ viewready: function() {
+ this.gridClassesWindowAppliqueA.getSelectionModel().selectRow(0);
+ },
+ scope: this
+ }
+ });
+
+ this.checkBoxOrdre = new Ext.form.Checkbox({
+ boxLabel: '<span style="font-weight:normal;">' + this.ConfigServeur.libelle.ordreMatieres + '</span>',
+ checked: false,
+ listeners: {
+ check: function() {
+ this.gereAffichageBoutonOk();
+ },
+ scope: this
+ }
+ });
+
+ this.checkBoxCoefficients = new Ext.form.Checkbox({
+ boxLabel: '<span style="font-weight:normal;">' + this.ConfigServeur.libelle.coefficients + '</span>',
+ checked: false,
+ listeners: {
+ check: function() {
+ this.gereAffichageBoutonOk();
+ },
+ scope: this
+ }
+ });
+
+ this.checkBoxSousMatieres = new Ext.form.Checkbox({
+ boxLabel: '<span style="font-weight:normal;">' + this.ConfigServeur.libelle.sousMatieres + '</span>',
+ checked: false,
+ listeners: {
+ check: function() {
+ this.gereAffichageBoutonOk();
+ },
+ scope: this
+ }
+ });
+
+ this.buttonOk = new Ext.Button({
+ text: this.ConfigServeur.libelle.ok,
+ handler: function() {
+ var ordre = this.checkBoxOrdre.getValue();
+ var coefficients = this.checkBoxCoefficients.getValue();
+ var sousMatieres = this.checkBoxSousMatieres.getValue();
+ var classes = [];
+
+ var records = this.gridClassesWindowAppliqueA.getSelectionModel().getSelections();
+
+ Ext.each(records, function(record) {
+
+ if (record.get('id') === '') {
+ classes = this.classes;
+ return false;
+ }
+
+ classes.push(record.data);
+ }, this);
+
+ this.fireEvent(
+ this.Constantes.eventId.appliqueA,
+ ordre,
+ coefficients,
+ sousMatieres,
+ classes);
+
+ this.windowAppliqueA.hide();
+ },
+ scope: this
+ });
+
+ this.gridClassesWindowAppliqueA.getSelectionModel().addListener(
+ 'selectionchange',
+ function() {
+ this.gereAffichageBoutonOk();
+ },
+ this);
+
+ this.windowAppliqueA = new Ext.Window({
+
+ title: this.ConfigServeur.libelle.appliquerA,
+ layout:'fit',
+ width:420,
+ height: 390,
+ closeAction:'hide',
+ resizable: false,
+ plain: true,
+
+ items: [
+ {
+ xtype: 'fieldset',
+ border: false,
+ autoHeight: true,
+ defaults: {
+ width: 200
+ },
+ items: [
+ {
+ xtype: 'panel',
+ html: this.ConfigServeur.libelle.selectionParams,
+ border: false,
+ width: 400,
+ unstyled: true,
+ height: 25
+ },
+ {
+ xtype: 'label',
+ html: this.ConfigServeur.libelle.paramAppliqueA+'<div style="margin: 0 0 5px 0"/>'
+ },
+ {
+ xtype: 'checkboxgroup',
+ columns: 1,
+ labelWidth: 30,
+ hideLabel: true,
+ items: [
+ this.checkBoxOrdre,
+ this.checkBoxCoefficients,
+ this.checkBoxSousMatieres
+ ],
+ height: 70
+ },
+ {
+ xtype: 'label',
+ html: this.ConfigServeur.libelle.classesAModifier+'<div style="margin-bottom: 10px"/>'
+ },
+ {
+ xtype: 'panel',
+ border: false,
+ style: 'margin-left: 25px;',
+ width: 130,
+ items: [this.gridClassesWindowAppliqueA]
+ },
+ {
+ xtype: 'panel',
+ border: false,
+ width: 380,
+ unstyled: true,
+ height: 60,
+ html: '<br/>' + this.ConfigServeur.messages.avertissementAppliquerA
+ }
+ ]
+ }
+ ],
+ buttons: [this.buttonOk,
+ {
+ text: this.ConfigServeur.libelle.annuler,
+ handler: function() {
+ this.windowAppliqueA.hide();
+ },
+ scope: this
+ }]
+ });
+
+ },
+
+ /**
+ * Gère l'affichage du bouton ok
+ */
+ gereAffichageBoutonOk: function() {
+
+ var disabled = false;
+
+ if ((this.checkBoxOrdre.getValue() === false) &&
+ (this.checkBoxCoefficients.getValue() === false) &&
+ (this.checkBoxSousMatieres.getValue() === false)
+ ) {
+ disabled = true;
+ }
+
+ if (this.gridClassesWindowAppliqueA.getSelectionModel().getSelections().length === 0) {
+ disabled = true;
+ }
+
+ if (disabled === true) {
+ this.buttonOk.disable();
+ }
+ else {
+ this.buttonOk.enable();
+ }
+
}
+
});
\ No newline at end of file
disabled: true
});
+ // Bouton "Plus d'actions"
+ this.btnPlusDActions = new Ext.Button({
+ xtype: 'tbbutton',
+ text : eliot.notes.Modele.libelle.plusDActions,
+ id: eliot.notes.parametrages.services.Constantes.composantId.idBoutonPlusDActions,
+ style:'margin-top: 3px;margin-left: 25px;',
+ menu: [
+ {
+ text: this.ConfigServeur.libelle.appliquerA + '...',
+ cls: 'x-btn-icon',
+ listeners: {
+ click : function() {
+ this.actionAppliqueA();
+ },
+ scope : this
+ }
+ }
+ ],
+ disabled:true
+ });
+
+
this.toolbar = new Ext.Toolbar({
border: true,
autoWidth: true,
items: [
this.btnCreer ,
this.btnModifier,
- this.btnSupprimer
+ this.btnSupprimer,
+ this.btnPlusDActions
]
});
var periode = this.periodeModel.getPeriodeExamen();
var itemSelectionne = this.serviceModel.getItemSelectionne();
+ if (this.ConfigServeur.data.classe !== undefined) {
+ this.btnPlusDActions.enable();
+ } else {
+ this.btnPlusDActions.disable();
+ }
+
// Création d'une sous matière si une classe est sélectionnée
if (
(this.ConfigServeur.data.classe !== undefined) &&
this.fireEvent(
this.Constantes.eventId.actionSupprimer
);
+ },
+ /**
+ * Appliquer à
+ */
+ actionAppliqueA: function() {
+ this.fireEvent(
+ this.Constantes.eventId.actionAppliqueA
+ );
}
+
});
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+Ext.ns('eliot.notes.parametrages.services');
+
+eliot.notes.parametrages.services.TraitementEnCoursController = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.notes.parametrages.services, config);
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.Constantes = this.ns.Constantes;
+ this.creeConfig(config);
+ },
+
+ creeConfig: function(config) {
+ this.config = Ext.apply({}, config);
+ },
+
+ observeViews: function(views) {
+ this.views = views;
+ },
+
+ getInterface: function() {
+ return {
+ getTraitementStore: this.getTraitementStore.createDelegate(this),
+ isTermine: this.isTermine.createDelegate(this),
+ actualise: this.actualise.createDelegate(this),
+ valide: this.valide.createDelegate(this),
+ interromps: this.interromps.createDelegate(this),
+ observeViews: this.observeViews.createDelegate(this)
+ };
+ },
+
+ creeTraitementStore: function() {
+ var store = new Ext.data.Store({
+ autoLoad: false,
+
+ reader: new Ext.data.JsonReader({
+ fields:[
+ {name:'structure', type:'string'},
+ {name:'matiere', type:'string'},
+ {name:'etat', type:'string'},
+ {name:'etatLibelle', type:'string'}
+ ]
+ })
+
+ });
+
+ store.loadData(this.ConfigServeur.data.traitementEnCours.traitements);
+
+ return store;
+ },
+
+ getTraitementStore: function() {
+ if (this.traitementStore == null) {
+ this.traitementStore = this.creeTraitementStore();
+ }
+ return this.traitementStore;
+ },
+
+ isTermine: function() {
+ var traitements = this.ConfigServeur.data.traitementEnCours.traitements;
+ var termine = false;
+
+ if (traitements != null) {
+ termine = true;
+
+ for (var i = 0; i < traitements.length; i++) {
+ var traitement = traitements[i];
+ if ((traitement.etat != this.Constantes.etat.termine)
+ && (traitement.etat != this.Constantes.etat.erreur)){
+ termine = false;
+ break;
+ }
+ }
+ }
+
+ return termine;
+ },
+
+ actualise: function() {
+
+ var typePeriodeIdParam = '';
+
+ if (this.ConfigServeur.data.traitementEnCours.typePeriodeId != null) {
+ typePeriodeIdParam = '&typePeriodeId='
+ + this.ConfigServeur.data.traitementEnCours.typePeriodeId;
+ }
+
+ window.location = this.ConfigServeur.url.urlPage
+ + '?idClasse=' + this.ConfigServeur.data.traitementEnCours.classeSourceId
+ + '&nature=' + this.ConfigServeur.data.traitementEnCours.naturePeriodeId
+ + typePeriodeIdParam;
+
+ },
+
+ valide: function() {
+ eliot.commun.AjaxHelper.request({
+ url: this.ConfigServeur.url.valide,
+ params: {},
+
+ success: function() {
+ this.actualise();
+ },
+
+ failure: function(reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.notes.Messages.showErreur(reponse.message);
+ }
+ else {
+ eliot.notes.Messages.showErreur(this.ConfigServeur.messages.erreurValider);
+ }
+ },
+ scope: this
+ });
+ },
+
+ interromps: function() {
+ eliot.commun.AjaxHelper.request({
+ url: this.ConfigServeur.url.interromps,
+ params: {},
+
+ success: function() {
+ this.actualise();
+ },
+
+ failure: function(reponse) {
+ if ((reponse.message !== undefined) && (reponse.message !== '')) {
+ eliot.notes.Messages.showErreur(reponse.message);
+ }
+ else {
+ eliot.notes.Messages.showErreur(this.ConfigServeur.messages.erreurInterrompre);
+ }
+ },
+ scope: this
+ });
+ }
+
+});
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+Ext.ns('eliot.notes.parametrages.services');
+
+eliot.notes.parametrages.services.TraitementEnCoursToolbarView = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.notes.parametrages.services, config);
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.Constantes = this.ns.Constantes;
+ this.creeConfig(config);
+ },
+
+ creeConfig: function(config) {
+ this.config = Ext.apply({
+ controller: undefined
+ }, config);
+ },
+
+ getInterface: function() {
+ return {
+ getItems: this.getItems.createDelegate(this),
+ termine: this.termine.createDelegate(this)
+ };
+ },
+
+ getItems: function() {
+ return [
+ new Ext.Toolbar({
+ border: true,
+ autoWidth: true,
+ height: 35,
+
+ items: [
+ this.creeButtonActualiser() ,
+ this.creeButtonValider(),
+ this.creeButtonInterrompre()
+ ]
+ })
+ ];
+ },
+
+ creeButtonActualiser: function() {
+ var button = new Ext.Button({
+ text: this.ConfigServeur.libelle.actualiser,
+ icon: this.ConfigServeur.icon.actualiser,
+ style:'margin-top: 3px;margin-left: 25px;',
+ listeners: {
+ click: function() {
+ this.config.controller.actualise();
+ },
+ scope: this
+ }
+ });
+
+ return button;
+ },
+
+ creeButtonValider: function() {
+ var button = new Ext.Button({
+ text: this.ConfigServeur.libelle.valider,
+ icon: this.ConfigServeur.icon.valider,
+ style:'margin-top: 3px;margin-left: 25px;',
+ listeners: {
+ click: function() {
+ this.config.controller.valide();
+ },
+ scope: this
+ },
+ disabled: !this.isTermine()
+ });
+
+ this.buttonValider = button;
+ return button;
+ },
+
+ creeButtonInterrompre: function() {
+ var button = new Ext.Button({
+ text: this.ConfigServeur.libelle.interrompre,
+ icon: this.ConfigServeur.icon.interrompre,
+ style:'margin-top: 3px;margin-left: 25px;',
+ listeners: {
+ click: function() {
+ this.config.controller.interromps();
+ },
+ scope: this
+ },
+ disabled: this.isTermine()
+ });
+
+ this.buttonInterrompre = button;
+ return button;
+ },
+
+ isTermine: function() {
+ return this.config.controller.isTermine();
+ },
+
+ termine: function() {
+ this.buttonValider.enable();
+ this.buttonInterrompre.disable();
+ }
+
+});
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+Ext.ns('eliot.notes.parametrages.services');
+
+eliot.notes.parametrages.services.TraitementEnCoursView = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.notes.parametrages.services, config);
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.Constantes = this.ns.Constantes;
+ this.creeConfig(config);
+ },
+
+ creeConfig: function(config) {
+ this.config = Ext.apply({
+ controller: undefined
+ }, config);
+ },
+
+ getInterface: function() {
+ return {
+ getItems: this.getItems.createDelegate(this),
+ getComboboxClasse: this.getComboboxClasse.createDelegate(this),
+ getComboboxNaturePeriode: this.getComboboxNaturePeriode.createDelegate(this),
+ getComboboxTypePeriode: this.getComboboxTypePeriode.createDelegate(this)
+ };
+ },
+
+ getItems: function() {
+
+ var cm = new Ext.grid.ColumnModel({
+ defaults:
+ {
+ menuDisabled: true,
+ resizable: false,
+ align: 'left'
+ },
+ columns: [
+ {
+ header: this.ConfigServeur.libelle.classe,
+ dataIndex: 'structure',
+ width: 150,
+ sortable: false
+ },
+ {
+ header: this.ConfigServeur.libelle.lblMatiere,
+ dataIndex: 'matiere',
+ width: 150,
+ sortable: false
+ },
+ {
+ header: this.ConfigServeur.libelle.statut,
+ dataIndex: 'etatLibelle',
+ width: 150,
+ sortable: false,
+ renderer: {
+ fn: function(value, metadata, record) {
+ var etat = record.get('etat');
+
+ if (etat == this.Constantes.etat.termine) {
+ return '<span style="color: green">' + value + '</span>';
+ }
+
+ if (etat == this.Constantes.etat.erreur) {
+ return '<span style="color: red">' + value + '</span>';
+ }
+
+ return value;
+
+ },
+ scope: this
+ }
+ }
+
+ ]
+ });
+
+ var grid = new Ext.grid.GridPanel({
+ baseCls: 'eliot-patch-ie-wrap x-panel',
+ store: this.config.controller.getTraitementStore(),
+ autoScroll: true,
+ colModel: cm,
+ cls: 'portal-default_table',
+ margins: '0 5 5 5',
+ border: true,
+ columnLines: true,
+ stripeRows: true
+ });
+
+
+ return grid;
+ },
+
+ getComboboxClasse: function() {
+ var store = new Ext.data.Store({
+ autoLoad: false,
+
+ reader: new Ext.data.JsonReader({
+ fields:[
+ {name:'id', type:'int'},
+ {name:'code', type:'string'}
+ ]
+ }),
+
+ data: [
+ {
+ id: this.ConfigServeur.data.traitementEnCours.classeSourceId,
+ code: this.ConfigServeur.data.traitementEnCours.classeSource}
+ ]
+
+ });
+
+ return new Ext.form.ComboBox({
+ store: store,
+ width: 120,
+ labelStyle : 'width: 60px',
+ fieldLabel: this.ConfigServeur.libelle.comboClasse,
+ labelSeparator: ' : ',
+ triggerAction: 'all',
+ selectOnFocus:true,
+ mode:'local',
+ valueField:'id',
+ displayField:'code',
+ editable: false,
+ disabled: true,
+ value: this.ConfigServeur.data.traitementEnCours.classeSourceId
+ });
+ },
+
+ getComboboxNaturePeriode: function() {
+ var store = new Ext.data.Store({
+ autoLoad: false,
+
+ reader: new Ext.data.JsonReader({
+ fields:[
+ {name:'id', type:'int'},
+ {name:'code', type:'string'}
+ ]
+ }),
+
+ data: [
+ {
+ id: this.ConfigServeur.data.traitementEnCours.naturePeriodeId,
+ code: this.ConfigServeur.data.traitementEnCours.naturePeriode
+ }
+ ]
+
+ });
+
+ return new Ext.form.ComboBox({
+ store: store,
+ width: 120,
+ labelStyle: 'width : 120px',
+ fieldLabel: this.ConfigServeur.libelle.comboNature,
+ labelSeparator: ' : ',
+ triggerAction: 'all',
+ selectOnFocus: true,
+ mode:'local',
+ valueField: 'id',
+ displayField: 'code',
+ editable: false,
+ disabled: true,
+ value: this.ConfigServeur.data.traitementEnCours.naturePeriodeId
+ });
+ },
+
+ getComboboxTypePeriode: function() {
+
+ if (this.ConfigServeur.data.traitementEnCours.typePeriodeId == null) {
+ return [];
+ }
+
+ var store = new Ext.data.Store({
+ autoLoad: false,
+
+ reader: new Ext.data.JsonReader({
+ fields:[
+ {name:'id', type:'int'},
+ {name:'code', type:'string'}
+ ]
+ }),
+
+ data: [
+ {
+ id: this.ConfigServeur.data.traitementEnCours.typePeriodeId,
+ code: this.ConfigServeur.data.traitementEnCours.typePeriode
+ }
+ ]
+
+ });
+
+ return new Ext.form.ComboBox({
+ store: store,
+ width: 120,
+ labelStyle: 'width : 70px',
+ fieldLabel: this.ConfigServeur.libelle.comboPeriode,
+ labelSeparator: ' : ',
+ triggerAction: 'all',
+ selectOnFocus: true,
+ mode:'local',
+ valueField: 'id',
+ displayField: 'code',
+ editable: false,
+ disabled: true,
+ value: this.ConfigServeur.data.traitementEnCours.typePeriodeId
+ });
+ }
+
+});
\ No newline at end of file