import org.lilie.services.eliot.scolarite.Periode
import org.lilie.services.eliot.scolarite.ModaliteMatiere
import org.lilie.services.eliot.textes.TypeActivite
+import org.lilie.services.eliot.textes.TypeActiviteParDefaut
/**
* Evaluation est un exercice noté ( devoir, interrogation, etc.. )
Boolean isRamenageSur20Necessaire() {
return (ramenerSur20 && noteMaxPossible != 20)
}
+
+ Boolean isTypeSport() {
+ return typeActivite.code == TypeActiviteParDefaut.SPORT.code
+ }
}
BigDecimal valeurNumerique
NoteTextuelle valeurTextuelle
+ // La note est sélectionnée pour le calcul de moyenne de sport utilisée dans le Brevet
+ Boolean choisiePourSport = false
+
static transients = [
'valeur',
'valeurNumeriqueAffichee', // pour ramenere sur 20
static constraints = {
valeurNumerique(nullable: true, validator: valeurNumeriqueValidator)
valeurTextuelle(nullable: true)
+ choisiePourSport(nullable: false, validator: choisiePourSportValidateur)
}
static belongsTo = [evaluation: Evaluation]
return true
}
+ static choisiePourSportValidateur = {Boolean val, Note note ->
+ return !val || note.evaluation.isTypeSport()
+ }
+
void setValeurNumerique(BigDecimal valeurNumerique) {
if (valeurNumerique != null) {
this.valeurTextuelle = null
void setValeurTextuelle(String code) {
Etablissement etablissement =
- evaluation.enseignement.service.structureEnseignement.etablissement
+ evaluation.enseignement.service.structureEnseignement.etablissement
NoteTextuelle noteTextuelle =
- NoteTextuelle.findByCodeAndEtablissement(code, etablissement)
+ NoteTextuelle.findByCodeAndEtablissement(code, etablissement)
if (!noteTextuelle) {
throw new IllegalArgumentException(
- "Il n'existe pas de NoteTextuelle avec le code $code pour l'établissement $etablissement"
+ "Il n'existe pas de NoteTextuelle avec le code $code pour l'établissement $etablissement"
)
}
}
return (valeurNumerique * 20) / evaluation.noteMaxPossible
}
+
+ def beforeValidate() {
+ if (choisiePourSport && !evaluation.isTypeSport()) {
+ choisiePourSport = false
+ }
+ }
}
--- /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="bper">
+
+ <comment>
+ Ajout de la colonne 'choisie_pour_sport' dans la table 'entnotes.note'
+ </comment>
+
+ <addColumn schemaName="entnotes" tableName="note">
+ <column name="choisie_pour_sport" type="boolean" defaultValue="false">
+ <constraints nullable="false"/>
+ </column>
+ </addColumn>
+
+ </changeSet>
+
+</databaseChangeLog>
<include file="changelogs/scolarite/2013-02-25-0025906.xml"/>
<include file="changelogs/scolarite/2013-02-26-0025834.xml"/>
<include file="changelogs/scolarite/2013-02-27-0025965.xml"/>
+ <include file="changelogs/scolarite/2013-02-27-0025987.xml"/>
<include file="changelogs/securite/2013-03-07-0025834.xml"/>
<include file="changelogs/scolarite/2013-03-07-0025834.xml"/>
</databaseChangeLog>
import org.lilie.services.eliot.notes.exception.NoteMaxNonValideException
import org.lilie.services.eliot.notes.exception.NoteMaxSurpasseeException
import org.lilie.services.eliot.notes.NotesFonction
+import org.hibernate.SessionFactory
/**
* Service sur les évaluations
NotesTypePeriodeService notesTypePeriodeService
NotesHibernateSessionService notesHibernateSessionService
+ SessionFactory sessionFactory
+
/**
* Retourne les Evaluations si le service est évaluable pour le type de période
* donné et le type équivalent. Les notes sont retournées uniquement pour les
evaluation.coefficient = params.coeff
}
+ Boolean typeChange = false
if (params.typeActivite != null) {
+ typeChange = (evaluation.typeActivite != params.typeActivite)
evaluation.typeActivite = params.typeActivite
}
)
}
+ if (typeChange) {
+ annuleSelectionPourSport(evaluation)
+ }
+
return evaluation
}
+ private void annuleSelectionPourSport(Evaluation evaluation) {
+ List<Note> notes = Note.findAllByEvaluation(evaluation)
+ notes*.choisiePourSport = false
+ notes*.save(failOnError: true)
+ sessionFactory.currentSession.flush()
+ }
+
/**
* Si l'évolution change sa modalité de matière il faut marquer les moyennes
* des sous-services correspondantes à l'ancienne et nouvelle modalité