This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 0a84939e86d17c8c65019f1f7c5948f12efd203c Author: Brendan Le Ny <bleny@codelutin.com> Date: Wed Jan 14 15:23:56 2015 +0100 Synthèses pour la scléro OK mais on est toujours en mois en non en trimestres --- .../fr/ifremer/wao/entity/ContactTopiaDao.java | 8 +- .../fr/ifremer/wao/entity/SampleRowTopiaDao.java | 5 +- .../wao/services/service/ContactsService.java | 3 +- .../fr/ifremer/wao/services/service/Synthesis.java | 5 +- .../wao/services/service/SynthesisService.java | 33 ++-- .../resources/i18n/wao-services_en_GB.properties | 2 +- .../main/resources/i18n/wao-web_fr_FR.properties | 2 +- .../src/main/webapp/WEB-INF/content/synthesis.jsp | 200 +++++++++++---------- .../src/main/webapp/WEB-INF/decorators/layout.jsp | 16 +- 9 files changed, 144 insertions(+), 130 deletions(-) diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java b/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java index fa642d2..a562789 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java @@ -224,7 +224,13 @@ public class ContactTopiaDao extends AbstractContactTopiaDao<Contact> { if (count == null) { count = 0; } - count += 1; + if (filter.getSampleRowFilter().getObsProgram().isSclerochronology()) { + // le réalisé est le nombre d'individus échantilonnés + count += contact.getSampleSize(); + } else { + // le réalisé est le nombre d'observation, on compte 1 observation pour 1 navire donc 1 pour chaque contact + count += 1; + } actualObservationsMyMonths.put(contactMonth, count); } diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java b/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java index 1fedec7..948d2b2 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java @@ -171,10 +171,11 @@ public class SampleRowTopiaDao extends AbstractSampleRowTopiaDao<SampleRow> { HqlAndParametersBuilder<SampleRow> sampleRowsQuery = toSampleRowHqlAndParametersBuilder(sampleRowFilter); + ObsProgram obsProgram = sampleRowFilter.getObsProgram(); String selectSumClause; - if (sampleRowFilter.getObsProgram().isObsMer()) { + if (obsProgram.isObsMer() || obsProgram.isSclerochronology()) { selectSumClause = "sum(sm.expectedTidesValue)"; - } else if (sampleRowFilter.getObsProgram().isObsVente()) { + } else if (obsProgram.isObsVente()) { selectSumClause = "sum(sm.expectedTidesValue * sr2.averageObservationsCount)"; } else { throw new UnsupportedOperationException(); diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java index 77e5e2d..17ebe9b 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java @@ -780,7 +780,6 @@ public class ContactsService extends WaoServiceSupport { ContactObservationEndDateAfterTodayException, ContactDataInputDateBeforeObservationEndDateException, ContactDataInputDateAfterTodayException, - MissingContactObservationEndDateException, MissingSampleSubmissionException, IllegalSampleSubmissionException, @@ -831,7 +830,7 @@ public class ContactsService extends WaoServiceSupport { if (contact.getObservationEndDate() == null) { throw new MissingContactObservationEndDateException(contact); } - if (contact.getSampleSubmission().before(contact.getObservationEndDate())) { + if (DateUtil.setMaxTimeOfDay(contact.getSampleSubmission()).before(contact.getObservationEndDate())) { throw new IllegalSampleSubmissionException(contact); } } diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/Synthesis.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/Synthesis.java index 1f5c02f..f6d774d 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/Synthesis.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/Synthesis.java @@ -25,6 +25,7 @@ import fr.ifremer.wao.entity.Boat; import org.jfree.chart.JFreeChart; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; @@ -48,7 +49,7 @@ public class Synthesis { protected Map<String, CompanySynthesis> companySyntheses = new HashMap<>(); - protected Set<String> sampleRowIds; + protected Set<String> sampleRowIds = new HashSet<>(); public Map<String, CompanySynthesis> getCompanySyntheses() { return companySyntheses; @@ -149,6 +150,6 @@ public class Synthesis { } public boolean isEmpty() { - return companySyntheses.isEmpty(); + return sampleRowIds.isEmpty(); } } diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java index c84c6d0..3256c1a 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java @@ -30,6 +30,7 @@ import fr.ifremer.wao.entity.Boat; import fr.ifremer.wao.entity.Company; import fr.ifremer.wao.entity.ContactState; import fr.ifremer.wao.entity.ContactTopiaDao; +import fr.ifremer.wao.entity.ObsProgram; import fr.ifremer.wao.entity.SampleRowTopiaDao; import fr.ifremer.wao.entity.SynthesisId; import fr.ifremer.wao.services.AuthenticatedWaoUser; @@ -54,12 +55,10 @@ import org.nuiton.util.DateUtil; import java.util.Calendar; import java.util.Collection; import java.util.Date; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; @@ -81,6 +80,8 @@ public class SynthesisService extends WaoServiceSupport { public Synthesis getSynthesis(ContactsFilter filter) { + ObsProgram obsProgram = filter.getSampleRowFilter().getObsProgram(); + Cache<SynthesisCacheKey, Synthesis> cache = serviceContext.getSynthesesCache(); SynthesisCacheKey synthesisCacheKey = new SynthesisCacheKey(filter); @@ -93,25 +94,25 @@ public class SynthesisService extends WaoServiceSupport { synthesis = new Synthesis(); - Set<String> sampleRowIds = new HashSet<>(); - filter.setFilterOnObservationBeginDate(true); - setExpectedVsActualObservationsByMonthsBarChartData(synthesis, filter); - setBoardingBoatsData(synthesis, filter); - setComplianceBoardingIndicator(synthesis, filter); - setDataInputDateReactivity(synthesis, filter); - setDataReliability(synthesis, filter); - sampleRowIds.addAll(dao.getSampleRowsIds(filter)); - - filter.setFilterOnObservationBeginDate(false); - setContactStatesStatistics(synthesis, filter); - sampleRowIds.addAll(dao.getSampleRowsIds(filter)); + synthesis.getSampleRowIds().addAll(dao.getSampleRowsIds(filter)); - synthesis.setSampleRowIds(sampleRowIds); + setExpectedVsActualObservationsByMonthsBarChartData(synthesis, filter); + if (obsProgram.isObsMer()) { + setComplianceBoardingIndicator(synthesis, filter); + setDataReliability(synthesis, filter); + } + if (obsProgram.isObsMer() || obsProgram.isObsVente()) { + setBoardingBoatsData(synthesis, filter); + setDataInputDateReactivity(synthesis, filter); + filter.setFilterOnObservationBeginDate(false); + synthesis.getSampleRowIds().addAll(dao.getSampleRowsIds(filter)); + setContactStatesStatistics(synthesis, filter); + } for (CompanySynthesis companySynthesis : synthesis.getCompanySyntheses().values()) { String companyId = companySynthesis.getCompanyId(); - Company company = getCompanyDao().findByTopiaId(companyId); + Company company = getCompanyDao().forTopiaIdEquals(companyId).findUnique(); companySynthesis.setCompanyName(company.getName()); } diff --git a/wao-services/src/main/resources/i18n/wao-services_en_GB.properties b/wao-services/src/main/resources/i18n/wao-services_en_GB.properties index b451f33..ba0265b 100644 --- a/wao-services/src/main/resources/i18n/wao-services_en_GB.properties +++ b/wao-services/src/main/resources/i18n/wao-services_en_GB.properties @@ -66,7 +66,7 @@ wao.import.contact.failure.missingSampleSize=You must provide de number of indiv wao.import.contact.failure.missingSampleSubmission=You must provide the sample submission date wao.import.contact.failure.missingTerrestrialLocation=You must provide the terrestrial location wao.import.contact.failure.not.updatable=Insufficient credentials to update contact -wao.import.contact.failure.observationEndDateAfterToday=La date de fin de la marée ne peut pas être postérieure à la date du jour +wao.import.contact.failure.observationEndDateAfterToday=La date de fin d'observation ne peut pas être postérieure à la date du jour wao.import.contact.failure.observationEndDateBeforeBeginDate=La date de fin d'observation ne peut pas être antérieure à celle du début wao.import.contact.failure.observedDataControlToCorrectionAsked=A contact cannot be accepted if observed data control shows that a correction is asked wao.import.contact.failure.sampleRowCodeMissing=The code of the sample row line is missing diff --git a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties index 3163b2a..f374c64 100644 --- a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties +++ b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties @@ -338,7 +338,7 @@ wao.ui.form.Contact.error.missingSampleReception=Il faut préciser la date de r wao.ui.form.Contact.error.missingSampleSize=Il faut préciser la taille de l'échantillon wao.ui.form.Contact.error.missingSampleSubmission=Il faut préciser la date d'envoi wao.ui.form.Contact.error.missingTerrestrialLocation=Il faut préciser le lieu d'observation -wao.ui.form.Contact.error.observationEndDateAfterToday=La date de fin de la marée ne peut pas être postérieure à la date du jour +wao.ui.form.Contact.error.observationEndDateAfterToday=La date de fin d'observation ne peut pas être postérieure à la date du jour wao.ui.form.Contact.error.observationEndDateBeforeBeginDate=La date de fin d'observation ne peut pas être antérieure à celle du début wao.ui.form.Contact.error.observedDataControlToCorrectionAsked=Un contact ne peut être accepté si le contrôle des données observées indique qu'une correction est demandée wao.ui.form.Contact.error.transmissionDateBeforeDataInputDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données diff --git a/wao-web/src/main/webapp/WEB-INF/content/synthesis.jsp b/wao-web/src/main/webapp/WEB-INF/content/synthesis.jsp index c7a8be8..c2d98d0 100644 --- a/wao-web/src/main/webapp/WEB-INF/content/synthesis.jsp +++ b/wao-web/src/main/webapp/WEB-INF/content/synthesis.jsp @@ -201,36 +201,40 @@ <s:property value="synthesis.expectedVsActualObservationsByMonthsChart" escapeHtml="false"/> </article> - <article> - <h2> - <s:text name="SynthesisId.GRAPH_BOARDING"/> - </h2> + <s:if test="obsMer || obsVente"> - <s:property value="synthesis.boardingBoatsChart" escapeHtml="false"/> - - <p> - <s:text name="wao.ui.synthesis.boarding.description"/> - </p> - - <p> - <s:text name="wao.ui.synthesis.boarding.mostUsedBoat"> - <s:param value="%{synthesis.maxBoardingValue}"/> - <s:param value="%{synthesis.maxBoardingBoat.name}"/> - <s:param value="%{synthesis.maxBoardingBoat.registrationCode}"/> - </s:text> - </p> - - <p> - <s:text name="wao.ui.synthesis.boarding.boardingCount"> - <s:param value="%{synthesis.invalidBoardingsCount}"/> - <s:param value="%{synthesis.boardingsCount}"/> - <%-- - <s:param value="%{synthesis.validBoardingsCount}"/> - --%> - </s:text> - </p> + <article> + <h2> + <s:text name="SynthesisId.GRAPH_BOARDING"/> + </h2> - </article> + <s:property value="synthesis.boardingBoatsChart" escapeHtml="false"/> + + <p> + <s:text name="wao.ui.synthesis.boarding.description"/> + </p> + + <p> + <s:text name="wao.ui.synthesis.boarding.mostUsedBoat"> + <s:param value="%{synthesis.maxBoardingValue}"/> + <s:param value="%{synthesis.maxBoardingBoat.name}"/> + <s:param value="%{synthesis.maxBoardingBoat.registrationCode}"/> + </s:text> + </p> + + <p> + <s:text name="wao.ui.synthesis.boarding.boardingCount"> + <s:param value="%{synthesis.invalidBoardingsCount}"/> + <s:param value="%{synthesis.boardingsCount}"/> + <%-- + <s:param value="%{synthesis.validBoardingsCount}"/> + --%> + </s:text> + </p> + + </article> + + </s:if> <s:if test="obsMer"> @@ -268,86 +272,90 @@ </s:if> - <article> - <h2> - <s:text name="SynthesisId.IND_CONTACT_STATE"/> - </h2> + <s:if test="obsMer || obsVente"> + + <article> + <h2> + <s:text name="SynthesisId.IND_CONTACT_STATE"/> + </h2> - <table class="table"> - <thead> - <tr> - <th> - <s:text name="wao.ui.entity.Company"/> - </th> - <s:iterator value="synthesis.companySynthesesOrderedByName.iterator.next().contactsStatesStatistics.keySet()" var="contactState"> + <table class="table"> + <thead> + <tr> <th> - <s:text name="%{#contactState.getI18nKey(obsProgram)}"/> + <s:text name="wao.ui.entity.Company"/> </th> - </s:iterator> - <th> - <s:text name="wao.ui.misc.total"/> - </th> - </tr> - </thead> - <tbody> - <s:iterator value="synthesis.companySynthesesOrderedByName"> - <tr> - <td> - <s:property value="companyName"/> - </td> - <s:iterator value="contactsStatesStatistics"> - <td> - <s:property value="value"/> - <s:set name="percentage" value="%{value.doubleValue() / contactsCount * 100}" /> - (<s:property value="#percentage"/> %) - </td> + <s:iterator value="synthesis.companySynthesesOrderedByName.iterator.next().contactsStatesStatistics.keySet()" var="contactState"> + <th> + <s:text name="%{#contactState.getI18nKey(obsProgram)}"/> + </th> </s:iterator> - <td> - <s:property value="contactsCount"/> - </td> + <th> + <s:text name="wao.ui.misc.total"/> + </th> </tr> - </s:iterator> - </tbody> - </table> + </thead> + <tbody> + <s:iterator value="synthesis.companySynthesesOrderedByName"> + <tr> + <td> + <s:property value="companyName"/> + </td> + <s:iterator value="contactsStatesStatistics"> + <td> + <s:property value="value"/> + <s:set name="percentage" value="%{value.doubleValue() / contactsCount * 100}" /> + (<s:property value="#percentage"/> %) + </td> + </s:iterator> + <td> + <s:property value="contactsCount"/> + </td> + </tr> + </s:iterator> + </tbody> + </table> - </article> + </article> - <article> - <h2> - <s:text name="SynthesisId.IND_ALLEGRO_REACTIVITY"/> - </h2> + <article> + <h2> + <s:text name="SynthesisId.IND_ALLEGRO_REACTIVITY"/> + </h2> - <table class="table"> - <thead> - <tr> - <th> - <s:text name="wao.ui.entity.Company"/> - </th> - <th> - <s:text name="wao.ui.synthesis.allegroReactivity.title"/> - </th> - </tr> - </thead> - <tbody> - <s:iterator value="synthesis.companySynthesesOrderedByName"> + <table class="table"> + <thead> <tr> - <td> - <s:property value="companyName"/> - </td> - <td<s:if test="dataInputDateReactivityHigh"> class="lower-than-expected"</s:if>> - <s:property value="dataInputDateReactivity"/> - <s:text name="wao.ui.unit.days"/> - </td> + <th> + <s:text name="wao.ui.entity.Company"/> + </th> + <th> + <s:text name="wao.ui.synthesis.allegroReactivity.title"/> + </th> </tr> - </s:iterator> - </tbody> - </table> + </thead> + <tbody> + <s:iterator value="synthesis.companySynthesesOrderedByName"> + <tr> + <td> + <s:property value="companyName"/> + </td> + <td<s:if test="dataInputDateReactivityHigh"> class="lower-than-expected"</s:if>> + <s:property value="dataInputDateReactivity"/> + <s:text name="wao.ui.unit.days"/> + </td> + </tr> + </s:iterator> + </tbody> + </table> - <p> - <s:text name="wao.ui.synthesis.allegroReactivity.description"/> - </p> + <p> + <s:text name="wao.ui.synthesis.allegroReactivity.description"/> + </p> - </article> + </article> + + </s:if> <s:if test="obsMer"> diff --git a/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp b/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp index 3a308f1..812822a 100644 --- a/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp +++ b/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp @@ -146,15 +146,13 @@ </s:a> </li> </s:if> - <s:if test=" ! sclerochronology"> - <s:if test="authenticatedWaoUser.authorizedToViewSynthesis"> - <li class="<decorator:getProperty property="page.synthesisMenuItemClass"/>"> - <s:url namespace="/%{obsProgram.name().toLowerCase()}" action="synthesis" id="synthesisUrl" /> - <s:a href="%{synthesisUrl}"> - <i class="fa fa-bar-chart-o"></i> <s:text name="wao.ui.page.Synthesis.title" /> - </s:a> - </li> - </s:if> + <s:if test="authenticatedWaoUser.authorizedToViewSynthesis"> + <li class="<decorator:getProperty property="page.synthesisMenuItemClass"/>"> + <s:url namespace="/%{obsProgram.name().toLowerCase()}" action="synthesis" id="synthesisUrl" /> + <s:a href="%{synthesisUrl}"> + <i class="fa fa-bar-chart-o"></i> <s:text name="wao.ui.page.Synthesis.title" /> + </s:a> + </li> </s:if> </ul> <ul class="nav pull-right"> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.