branch feature/bug-on-save updated (8b06eb8e -> 27263fd9)
This is an automated email from the git hooks/post-receive script. New change to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git omits 8b06eb8e refs #249 update TU omits b8fcd760 refs #249 fix issue on empty list check omits 7431e430 refs #249 add poolType as saveVoters parameters to as current pooltype change and not previous one. List validation review to fix validation not working omits 127f396d refs #248 improve space omits 29f777d6 refs #248 improve readable omits ae2ebdc1 refs #248 update gitlab-ci configuration remove commented block omits a7df690c refs #248 update gitlab-ci configuration on docker:feature, update artifact name omits 24490fd7 refs #248 update gitlab-ci configuration sur docker:feature omits 78d7c179 refs #248 update gitlab-ci configuration omits 43c8eb89 refs #248 update gitlab-ci configuration omits 841067c6 refs #248 correction sur passage des paramètres de configuration d'un vote omits b6409294 refs #248 ajout de construction du docker-feature pour demo omits 7293307f refs #248 correction conf artifact omits a99c73f3 refs #248 add docker feature omits a70e5b4a refs #248 fix call unexisting function getConfig() omits aef6cc42 refs #248 avoid error in console JS when navigate from tab o tab omits 441fcda6 refs #248 fix call unexisting function getConfig() omits 1f6a277b refs #248 fix to avoid js error omits b2150808 refs #248 add voteCountingConfig to PollBean as it it send into the Json query and request failed if not present omits e12c86ca refs #248 remove deprecated code omits efed5010 refs #248 remove unvolontary commit file omits ead48928 refs #248 fix choices Adding/Removing process omits 4dbf8c44 refs #248 wip modification des choix adds aaa8e2b8 fix some Sonar Issus adds bb82eea1 Update to topia 3.7 adds 39cc29f6 Merge branch 'feature/update_to_topia_3.7' into 'develop' adds 6375ef34 Merge branch 'develop' of gitlab.nuiton.org:chorem/pollen into develop new a96af348 refs #248 wip modification des choix new e1e7b4a8 refs #248 fix choices Adding/Removing process new 65a9f01d refs #248 remove unvolontary commit file new 22af8ac9 refs #248 remove deprecated code new ad98d35f refs #248 add voteCountingConfig to PollBean as it it send into the Json query and request failed if not present new 2c3775f4 refs #248 fix to avoid js error new 0b83b318 refs #248 fix call unexisting function getConfig() new 10af43d3 refs #248 avoid error in console JS when navigate from tab o tab new dca84312 refs #248 fix call unexisting function getConfig() new 10774059 refs #248 add docker feature new 00185c56 refs #248 correction conf artifact new b85d2454 refs #248 ajout de construction du docker-feature pour demo new 1dab892e refs #248 correction sur passage des paramètres de configuration d'un vote new d56fd5ef refs #248 update gitlab-ci configuration new 44ac4e8f refs #248 update gitlab-ci configuration new f1186876 refs #248 update gitlab-ci configuration sur docker:feature new 758c34fa refs #248 update gitlab-ci configuration on docker:feature, update artifact name new 78c3b2fe refs #248 update gitlab-ci configuration remove commented block new 84f61c61 refs #248 improve readable new 5d88fdf4 refs #248 improve space new 8933f082 refs #249 add poolType as saveVoters parameters to as current pooltype change and not previous one. List validation review to fix validation not working new 247025bd refs #249 fix issue on empty list check new 27263fd9 refs #249 update TU This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (8b06eb8e) \ N -- N -- N refs/heads/feature/bug-on-save (27263fd9) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 23 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 27263fd94ee2f23fb4efd4bde184282b9c17916c Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 17:44:31 2019 +0200 refs #249 update TU commit 247025bda9d5609f6811e72662065eacdf97f9d7 Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 17:44:18 2019 +0200 refs #249 fix issue on empty list check commit 8933f082d59dbffb43a0b5b6db2e57eeba1e42a6 Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 17:06:16 2019 +0200 refs #249 add poolType as saveVoters parameters to as current pooltype change and not previous one. List validation review to fix validation not working commit 5d88fdf40ccdab5c7279e6a99fb9d8a87175169e Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 09:43:36 2019 +0200 refs #248 improve space commit 84f61c6117e64b28c0692da055ecdc1deb7221ff Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 09:43:15 2019 +0200 refs #248 improve readable commit 78c3b2fe39f949b74a25c46368adb6b2c353795b Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 09:32:42 2019 +0200 refs #248 update gitlab-ci configuration remove commented block commit 758c34fadde4e9cfbc452d3679f42a0c5b8bc00d Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 16:53:57 2019 +0200 refs #248 update gitlab-ci configuration on docker:feature, update artifact name commit f1186876dec772a5b9e4b62c4f49f17aad5512a0 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 16:52:15 2019 +0200 refs #248 update gitlab-ci configuration sur docker:feature commit 44ac4e8f5b2cb89e5b1797745a1ee2b0f0e134a8 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 16:38:35 2019 +0200 refs #248 update gitlab-ci configuration commit d56fd5ef1fd6fab68f198c0bea87c0724e09bf55 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 15:58:44 2019 +0200 refs #248 update gitlab-ci configuration commit 1dab892e85c42a0be3f79a8cd1045c4d493e74bc Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 15:07:20 2019 +0200 refs #248 correction sur passage des paramètres de configuration d'un vote commit b85d245482fe031d4af01d14c58d8bf7ae924c6f Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 11:05:33 2019 +0200 refs #248 ajout de construction du docker-feature pour demo commit 00185c56afaaa7d9257b09c1a7e2d81945ff519b Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 10:42:24 2019 +0200 refs #248 correction conf artifact commit 107740596992d6efbbc3d6bcbe15939368dbd8d1 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 10:39:54 2019 +0200 refs #248 add docker feature commit dca843121df116548ecaa0378d5caf8c662208bf Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 09:16:43 2019 +0200 refs #248 fix call unexisting function getConfig() commit 10af43d37df755175ed30c9a61b915d7306d6ade Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 09:14:51 2019 +0200 refs #248 avoid error in console JS when navigate from tab o tab commit 0b83b318eb2f41d746aa53e74851dbd87b3527c6 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 16:19:25 2019 +0200 refs #248 fix call unexisting function getConfig() commit 2c3775f4b07d6973435b9c0e2ca665ead0fecd48 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 15:48:13 2019 +0200 refs #248 fix to avoid js error commit ad98d35f38b59572bf728b4b21b9cd01f6f6546d Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 15:47:38 2019 +0200 refs #248 add voteCountingConfig to PollBean as it it send into the Json query and request failed if not present commit 22af8ac94bef3fc1f4faf66e0fd17d9542ac4c85 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 12:18:39 2019 +0200 refs #248 remove deprecated code commit 65a9f01dbfe0a2fa028537556d28dbf8eb5d62f9 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 11:57:15 2019 +0200 refs #248 remove unvolontary commit file commit e1e7b4a8385cad86ecca9774e7fa161e471b639b Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 11:52:22 2019 +0200 refs #248 fix choices Adding/Removing process commit a96af34835bf2fc249053e9a5e26afdbeca9710b Author: dcosse <cosse@codelutin.com> Date: Fri Oct 4 17:49:03 2019 +0200 refs #248 wip modification des choix Summary of changes: .../common/V3_1_0_5__Extract_email_addresses.java | 10 ++- .../persistence/PollenFlywayServiceImpl.java | 13 +++- .../pollen/services/service/CryptoService.java | 74 +++++++++++++++------- .../pollen/services/service/SocialAuthService.java | 43 +++++++------ pom.xml | 4 +- 5 files changed, 91 insertions(+), 53 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a96af34835bf2fc249053e9a5e26afdbeca9710b Author: dcosse <cosse@codelutin.com> Date: Fri Oct 4 17:49:03 2019 +0200 refs #248 wip modification des choix --- pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html | 1 + pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html index 9e7a2119..3ec593e5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html @@ -142,6 +142,7 @@ import "../components/time-picker.tag.html"; this.hasNewFile = false; this.valueText = this.opts.choice.choiceType === "TEXT" ? this.opts.choice.choiceValue : null; this.showDescription = this.opts.choice.description && this.opts.choice.description.length; + this.opts.choice.choiceType = this.choiceType || "TEXT"; if (this.opts.choice.choiceType.startsWith("DATE")) { this.date = { diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html index 88bca7a7..05b6cf8e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html @@ -45,7 +45,7 @@ class="c-button c-button--ghost-error" show={!parent.form.hasVotes} disabled={parent.form.hasVotes || parent.form.model.closed} - onclick="{parent.removeChoice(index)}"> + onclick="{parent.removeChoice(parent.form.model.questions[0], index)}"> <i class="fa fa-trash" aria-hidden="true"/> </button> </div> @@ -75,7 +75,8 @@ this.installBundle(this.session, "poll_choices", this.opts.emitter); this.on("mount", () => { - let choices = (this.refs.choicesDrag || []) + let choiceDrag = this.refs.choicesDrag && Array.isArray(this.refs.choicesDrag) ? this.refs.choicesDrag : []; + let choices = (choiceDrag) .sort((c1, c2) => Math.sign(c1.choice.choiceOrder - c2.choice.choiceOrder)) .map(c => c.refs.choice); choices[0] && choices[0].focus(); @@ -176,7 +177,8 @@ this.addOneChoice = () => { if (!this.form.hasVotes) { this.submit(); - this.form.addNewChoice(0); + let questionId = this.form.model.questions[0].id; + this.form.addNewChoice(questionId); this.update(); this.placeChoices(true); let choices = this.getChoicesDragTab() @@ -186,9 +188,9 @@ } }; - this.removeChoice = index => () => { - if (!this.form.hasVotes) { - this.form.removeChoice(0, index); + this.removeChoice = (question, index) => () => { + if (typeof index === "number") { + this.form.removeChoice(question.id, index); this.compatChoiceOrders(); this.update(); this.placeChoices(true); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit e1e7b4a8385cad86ecca9774e7fa161e471b639b Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 11:52:22 2019 +0200 refs #248 fix choices Adding/Removing process --- .../org/chorem/pollen/rest/api/v1/ChoiceApi.java | 19 +++++++++---- .../pollen/services/service/ChoiceService.java | 23 +++++++++++++++ .../pollen/services/service/QuestionService.java | 33 ++++------------------ 3 files changed, 43 insertions(+), 32 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java index 328f1027..f434bdc8 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java @@ -21,6 +21,8 @@ package org.chorem.pollen.rest.api.v1; * #L% */ +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.chorem.pollen.persistence.entity.Choice; import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.Question; @@ -51,13 +53,15 @@ import java.util.List; @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class ChoiceApi { - + @Path("polls/{pollId}/questions/{questionId}/choices") @GET public List<ChoiceBean> getChoices(@Context ChoiceService choiceService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId) { - + + Log log = LogFactory.getLog(ChoiceApi.class); + log.debug("getChoices" + " pollId:" + " questionId:" + questionId); List<ChoiceBean> choices = choiceService.getChoices(questionId.getEntityId()); return choices; @@ -69,7 +73,9 @@ public class ChoiceApi { @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, @PathParam("choiceId") PollenEntityId<Choice> choiceId) { - + + Log log = LogFactory.getLog(ChoiceApi.class); + log.debug("getChoice" + " pollId:" + " questionId:" + questionId); return choiceService.getChoice(questionId.getEntityId(), choiceId.getEntityId()); } @@ -82,7 +88,8 @@ public class ChoiceApi { @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, ChoiceBean choice) throws InvalidFormException { - + Log log = LogFactory.getLog(ChoiceApi.class); + log.debug("editChoice" + " pollId:" + " questionId:" + questionId); return choiceService.editChoice(questionId.getEntityId(), choice); } @@ -93,7 +100,9 @@ public class ChoiceApi { @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, @PathParam("choiceId")PollenEntityId<Choice> choiceId) throws InvalidFormException { - + + Log log = LogFactory.getLog(ChoiceApi.class); + log.debug("deleteChoice" + " pollId:" + " questionId:" + questionId); choiceService.deleteChoice(questionId.getEntityId(), choiceId.getEntityId()); } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java index 91b1a0c5..70d3abeb 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java @@ -36,6 +36,7 @@ import org.chorem.pollen.services.bean.PollenEntityRef; import org.chorem.pollen.services.bean.ReportResumeBean; import org.chorem.pollen.services.service.security.PollenPermissions; +import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Set; @@ -218,6 +219,28 @@ public class ChoiceService extends PollenServiceSupport { return result; } + + protected void saveChoices(Question question, List<ChoiceBean> choicesToSave) { + boolean questionExists = question.isPersisted(); + + List<Choice> existingChoices = questionExists ? getChoiceDao().findAll(question) : new ArrayList<>(); + + if (CollectionUtils.isNotEmpty(choicesToSave)) { + + for (ChoiceBean choice : choicesToSave) { + + Choice persistedChoice = saveChoice(question, choice); + existingChoices.remove(persistedChoice); + + } + } + + // the remaining choices have been deleted by the user and must be removed + if (CollectionUtils.isNotEmpty(existingChoices)) { + getChoiceDao().deleteAll(existingChoices); + } + + } protected Choice saveChoice(Question question, ChoiceBean choice) { diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/QuestionService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/QuestionService.java index 5c103be6..72ccc936 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/QuestionService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/QuestionService.java @@ -5,7 +5,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.chorem.pollen.persistence.entity.Choice; import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.PollenPrincipal; -import org.chorem.pollen.persistence.entity.PollenResource; import org.chorem.pollen.persistence.entity.Question; import org.chorem.pollen.persistence.entity.QuestionImpl; import org.chorem.pollen.persistence.entity.QuestionTopiaDao; @@ -155,26 +154,17 @@ public class QuestionService extends PollenServiceSupport { Question toSave; - List<Choice> existingChoices; - - if (questionExists) { // get existing question - toSave = getQuestion(poll, question.getEntityId()); - - existingChoices = getChoiceDao().findAll(toSave); - + } else { // create a new question toSave = questionDao.create(); - toSave.setPoll(poll); - - existingChoices = new ArrayList<>(); - + } toSave.setChoiceAddAllowed(question.isChoiceAddAllowed()); @@ -191,21 +181,10 @@ public class QuestionService extends PollenServiceSupport { String configToJson = getVoteCountingService().configToJson(question.getVoteCountingConfig()); toSave.setVoteCountingConfig(configToJson); - // -- choice -- // - - if (CollectionUtils.isNotEmpty(question.getChoices())) { - - ChoiceService choiceService = getChoiceService(); - - for (ChoiceBean choice : question.getChoices()) { - - choice.setChoiceOrder(existingChoices.size()); - Choice persistedChoice = choiceService.saveChoice(toSave, choice); - existingChoices.add(persistedChoice); - - } - } - + // -- choices -- // + ChoiceService choiceService = getChoiceService(); + choiceService.saveChoices(toSave, question.getChoices()); + return toSave; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 65a9f01dbfe0a2fa028537556d28dbf8eb5d62f9 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 11:57:15 2019 +0200 refs #248 remove unvolontary commit file --- .../java/org/chorem/pollen/rest/api/v1/ChoiceApi.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java index f434bdc8..328f1027 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java @@ -21,8 +21,6 @@ package org.chorem.pollen.rest.api.v1; * #L% */ -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.pollen.persistence.entity.Choice; import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.Question; @@ -53,15 +51,13 @@ import java.util.List; @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class ChoiceApi { - + @Path("polls/{pollId}/questions/{questionId}/choices") @GET public List<ChoiceBean> getChoices(@Context ChoiceService choiceService, @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId) { - - Log log = LogFactory.getLog(ChoiceApi.class); - log.debug("getChoices" + " pollId:" + " questionId:" + questionId); + List<ChoiceBean> choices = choiceService.getChoices(questionId.getEntityId()); return choices; @@ -73,9 +69,7 @@ public class ChoiceApi { @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, @PathParam("choiceId") PollenEntityId<Choice> choiceId) { - - Log log = LogFactory.getLog(ChoiceApi.class); - log.debug("getChoice" + " pollId:" + " questionId:" + questionId); + return choiceService.getChoice(questionId.getEntityId(), choiceId.getEntityId()); } @@ -88,8 +82,7 @@ public class ChoiceApi { @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, ChoiceBean choice) throws InvalidFormException { - Log log = LogFactory.getLog(ChoiceApi.class); - log.debug("editChoice" + " pollId:" + " questionId:" + questionId); + return choiceService.editChoice(questionId.getEntityId(), choice); } @@ -100,9 +93,7 @@ public class ChoiceApi { @PathParam("pollId") PollenEntityId<Poll> pollId, @PathParam("questionId") PollenEntityId<Question> questionId, @PathParam("choiceId")PollenEntityId<Choice> choiceId) throws InvalidFormException { - - Log log = LogFactory.getLog(ChoiceApi.class); - log.debug("deleteChoice" + " pollId:" + " questionId:" + questionId); + choiceService.deleteChoice(questionId.getEntityId(), choiceId.getEntityId()); } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 22af8ac94bef3fc1f4faf66e0fd17d9542ac4c85 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 12:18:39 2019 +0200 refs #248 remove deprecated code --- .../org/chorem/pollen/services/service/ChoiceService.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java index 70d3abeb..01ad0e2c 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java @@ -272,19 +272,6 @@ public class ChoiceService extends PollenServiceSupport { // create a new choice toSave = choiceDao.create(); - - // create a new principal - PollenPrincipal principal = getSecurityService().generatePollenPrincipal(); - - //FIXME -// PollenPrincipal creator = choice.getCreator(); -// if (creator != null) { -// principal.setChoiceValue(creator.getChoiceValue()); -// principal.setEmail(creator.getEmail()); -// } - - //FIXME JC181002 - Useless setCreator, overriden later on - toSave.setCreator(principal); toSave.setQuestion(question); } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit ad98d35f38b59572bf728b4b21b9cd01f6f6546d Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 15:47:38 2019 +0200 refs #248 add voteCountingConfig to PollBean as it it send into the Json query and request failed if not present --- .../org/chorem/pollen/services/bean/PollBean.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java index d252c153..600c79a3 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java @@ -26,6 +26,7 @@ import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.PollType; import org.chorem.pollen.persistence.entity.ResultVisibility; import org.chorem.pollen.persistence.entity.VoteVisibility; +import org.chorem.pollen.votecounting.model.VoteCountingConfig; import java.util.ArrayList; import java.util.Date; @@ -131,6 +132,8 @@ public class PollBean extends PollenBean<Poll> { protected List<String> emailAddressSuffixes; protected List<QuestionBean> questions; + + protected VoteCountingConfig voteCountingConfig; public String getPermission() { return permission; @@ -426,4 +429,20 @@ public class PollBean extends PollenBean<Poll> { } this.questions.add(question); } + + /** + * TODO FIXE ME + * Not sure it should be there, but it is part of send query + */ + public VoteCountingConfig getVoteCountingConfig() { + return voteCountingConfig; + } + + /** + * TODO FIXE ME + * Not sure it should be there, but it is part of send query + */ + public void setVoteCountingConfig(VoteCountingConfig voteCountingConfig) { + this.voteCountingConfig = voteCountingConfig; + } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 2c3775f4b07d6973435b9c0e2ca665ead0fecd48 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 15:48:13 2019 +0200 refs #248 fix to avoid js error --- .../src/main/web/tag/poll/Choice.tag.html | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html index 3ec593e5..d317f688 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html @@ -30,15 +30,28 @@ import "../components/time-picker.tag.html"; title="{_t.text}"> <i class="fa fa-pencil" aria-hidden="true"></i> </button> - <input type="text" + <input show="{opts.choice.choiceType === 'TEXT'}" + type="text" ref="choiceText" tabindex="1" - class={opts.choice.choiceType === 'TEXT' ? 'selected' : 'hidden'} + class='selected' placeholder="{_t.text_placeholder}" disabled={opts.disabled} value={valueText} - required={opts.choice.choiceType === 'TEXT'} - pattern={opts.choice.choiceType === 'TEXT' ? ".*[^\\s]+.*" : ""} + required + pattern=".*[^\\s]+.*" + maxlength="255" + title={_t.text_notBlank} + onchange={onTextChange}/> + <input if="{opts.choice.choiceType !== 'TEXT'}" + type="text" + ref="choiceText" + tabindex="1" + class='hidden' + placeholder="{_t.text_placeholder}" + disabled={opts.disabled} + value={valueText} + pattern="" maxlength="255" title={_t.text_notBlank} onchange={onTextChange}/> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 0b83b318eb2f41d746aa53e74851dbd87b3527c6 Author: dcosse <cosse@codelutin.com> Date: Mon Oct 7 16:19:25 2019 +0200 refs #248 fix call unexisting function getConfig() --- pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index 4f4079ef..513121ab 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -523,7 +523,7 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; this.form.model.anonymousVoteAllowed = this.refs.anonymousVote.checked; this.form.model.resultVisibility = this.refs.resultVisibility.value; this.form.model.commentVisibility = this.refs.commentVisibility.value; - this.form.model.voteCountingConfig = this.refs.config ? this.refs.config.getConfig() : {}; + this.form.model.voteCountingConfig = this.refs.config && typeof this.refs.config.getConfig === "function" ? this.refs.config.getConfig() : {}; } this.form.model.endDate = this.refs.votePeriod.checked ? this.refs.endDate.getValue() : undefined; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 10af43d37df755175ed30c9a61b915d7306d6ade Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 09:14:51 2019 +0200 refs #248 avoid error in console JS when navigate from tab o tab --- pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html | 8 ++++---- pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html index 93f67d4d..4fbca611 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html @@ -142,13 +142,13 @@ import "./CheckEmails.tag.html"; this.submitStep = (e) => { e.preventDefault(); e.stopPropagation(); - if (this.form.step === 0) { + if (this.form.step === 0 && this.refs.description) { this.refs.description.submit(); - } else if (this.form.step === 1) { + } else if (this.form.step === 1 && this.refs.choices) { this.refs.choices.submit(); - } else if (this.form.step === 2) { + } else if (this.form.step === 2 && this.refs.settings) { this.refs.settings.submit(); - } else if (this.form.step === 3) { + } else if (this.form.step === 3 && this.refs.voters) { this.refs.voters.submit(); } if (!this.form.model.gtuValidated && !this.showSummary && (!this.form.creation || this.form.step === this.form.steps.length - 1)) { diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index 513121ab..5591cd54 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -518,11 +518,11 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; this.form.model.beginChoiceDate = this.refs.addChoices.checked ? this.refs.beginChoiceDate.getValue() : undefined; this.form.model.endChoiceDate = this.refs.addChoices.checked ? this.refs.endChoiceDate.getValue() : undefined; - this.form.model.beginDate = this.refs.votePeriod.checked ? this.refs.beginDate.getValue() : undefined; - this.form.model.voteVisibility = this.refs.voteVisibility.value; - this.form.model.anonymousVoteAllowed = this.refs.anonymousVote.checked; - this.form.model.resultVisibility = this.refs.resultVisibility.value; - this.form.model.commentVisibility = this.refs.commentVisibility.value; + this.form.model.beginDate = this.refs.votePeriod && this.refs.votePeriod.checked ? this.refs.beginDate.getValue() : undefined; + this.form.model.voteVisibility = this.refs.voteVisibility ? this.refs.voteVisibility.value : 'EVERYBODY'; + this.form.model.anonymousVoteAllowed = this.refs.anonymousVote ? this.refs.anonymousVote.checked : false; + this.form.model.resultVisibility = this.refs.resultVisibility ? this.refs.resultVisibility.value : 'EVERYBODY'; + this.form.model.commentVisibility = this.refs.commentVisibility ? this.refs.commentVisibility.value : 'EVERYBODY'; this.form.model.voteCountingConfig = this.refs.config && typeof this.refs.config.getConfig === "function" ? this.refs.config.getConfig() : {}; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit dca843121df116548ecaa0378d5caf8c662208bf Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 09:16:43 2019 +0200 refs #248 fix call unexisting function getConfig() --- pollen-ui-riot-js/src/main/web/js/PollForm.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/js/PollForm.js b/pollen-ui-riot-js/src/main/web/js/PollForm.js index 08e37033..a3a747d9 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -239,7 +239,8 @@ class PollForm { this.pageTracker.trackCreatePoll(this.step); this.maxStepReached = this.step; } - if (this.creation && this.step === 3) { + // step 2 = Option, user can choise how to expose the vote + if (this.creation && this.step === 2) { voterListService.addMeIfEmpty(); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 107740596992d6efbbc3d6bcbe15939368dbd8d1 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 10:39:54 2019 +0200 refs #248 add docker feature --- .gitlab-ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c62c52a..d1643d72 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -162,6 +162,29 @@ docker: tags: - docker +docker-feature: + image: registry.nuiton.org/codelutin/dockerfiles:docker + stage: release + when: manual + only: + - /^feature.*$/ + artifacts: + paths: + - pollen-rest-api/target/pollen-rest-api-*.war + - pollen-ui-riot-js/target/dist + - expire_in: 1 day + name: "${CI_BUILD_REF_NAME}" + script: + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nuiton.org + - docker build --no-cache --file Dockerfile-latest -t registry.nuiton.org/chorem/pollen:${CI_COMMIT_REF_NAME#feature/} . + - docker push registry.nuiton.org/chorem/pollen:${CI_COMMIT_REF_NAME#feature/} + - docker logout registry.nuiton.org + dependencies: + - build-java + - build-js + tags: + - docker-feature + pages: image: python:alpine stage: pages -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 00185c56afaaa7d9257b09c1a7e2d81945ff519b Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 10:42:24 2019 +0200 refs #248 correction conf artifact --- .gitlab-ci.yml | 2 +- pollen-ui-riot-js/src/main/web/js/Message.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1643d72..4e3aa4a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -172,7 +172,7 @@ docker-feature: paths: - pollen-rest-api/target/pollen-rest-api-*.war - pollen-ui-riot-js/target/dist - - expire_in: 1 day + expire_in: 1 day name: "${CI_BUILD_REF_NAME}" script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nuiton.org diff --git a/pollen-ui-riot-js/src/main/web/js/Message.js b/pollen-ui-riot-js/src/main/web/js/Message.js index 339ccbc6..556a8690 100644 --- a/pollen-ui-riot-js/src/main/web/js/Message.js +++ b/pollen-ui-riot-js/src/main/web/js/Message.js @@ -35,6 +35,7 @@ class Message { } else { this.content = Object.values(e).reduce((messages, messagesfield) => messages.concat(messagesfield), []); } + console.log(this.content); if (!this.timeout) { this.timeout = timeout; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit b85d245482fe031d4af01d14c58d8bf7ae924c6f Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 11:05:33 2019 +0200 refs #248 ajout de construction du docker-feature pour demo --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e3aa4a6..7dedc2ea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,6 +46,7 @@ demo: - build-js tags: - docker + - docker-feature release: image: registry.nuiton.org/codelutin/dockerfiles:maven-release-with-frequent-libraries @@ -136,8 +137,6 @@ sonar_job_ui: only: - schedules - - docker: image: registry.nuiton.org/codelutin/dockerfiles:docker stage: release -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 1dab892e85c42a0be3f79a8cd1045c4d493e74bc Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 15:07:20 2019 +0200 refs #248 correction sur passage des paramètres de configuration d'un vote --- .../src/main/web/tag/poll/Settings.tag.html | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index 5591cd54..a4d992d1 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -131,7 +131,7 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; tabindex="1" name="voteCountingTypeRadios" ref="voteCountingType{type.id}" - checked="{type && type.id.toString() === form.model.voteCountingType}" + checked="{type && type.id.toString() === form.model.questions[0].voteCountingType}" onchange={voteCountingTypeChanged}/> <span>{type.name}</span> </label> @@ -140,7 +140,7 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; <select class="c-field choice-select" tabindex="1" ref="voteCountingType" - value={form.model.voteCountingType} + value={form.model.questions[0].voteCountingType} disabled={form.hasVotes || form.model.closed} onchange={voteCountingTypeChanged}> <option each={type in form.voteCountingTypes} @@ -164,10 +164,10 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; id="choiceAddAllowed" ref="addChoices" disabled={form.hasVotes || form.model.closed} - checkboxchecked={form.model.choiceAddAllowed} + checkboxchecked={form.model.questions[0].choiceAddAllowed} ontogglecheckbox={toggleChoiceAddAllowed}/> </div> - <div show="{form.model.choiceAddAllowed}" class="config-period"> + <div show="{form.model.questions[0].choiceAddAllowed}" class="config-period"> <div class="o-form-element"> <label class="c-label" for="beginChoiceDate"> {_t.beginChoiceDate} @@ -176,7 +176,7 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; tabindex="1" name="beginChoiceDate" id="beginChoiceDate" - datetime={form.model.beginChoiceDate} + datetime={form.model.questions[0].beginChoiceDate} disabled={form.hasVotes || form.model.closed}/> </div> <div class="o-form-element"> @@ -187,27 +187,27 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; tabindex="1" name="endChoiceDate" id="endChoiceDate" - datetime={form.model.endChoiceDate} + datetime={form.model.questions[0].endChoiceDate} disabled={form.hasVotes || form.model.closed}/> </div> </div> - <MaxChoicesNumberConfig if={form.model.voteCountingType == 1 || form.model.voteCountingType == 4} + <MaxChoicesNumberConfig if={form.model.questions[0].voteCountingType == 1 || form.model.questions[0].voteCountingType == 4} ref="config" - config={form.model.voteCountingConfig} - count-choices={form.questions[0].choices.length} + config={form.model.questions[0].voteCountingConfig} + count-choices={form.model.questions[0].choices.length} disabled={form.hasVotes || form.model.closed}/> - <BordaConfig if={form.model.voteCountingType == 5} + <BordaConfig if={form.model.questions[0].voteCountingType == 5} ref="config" - config={form.model.voteCountingConfig} - count-choices={form.questions[0].choices.length} + config={form.model.questions[0].voteCountingConfig} + count-choices={form.model.questions[0].choices.length} disabled={form.hasVotes || form.model.closed}/> - <CumulativeConfig if={form.model.voteCountingType == 2} + <CumulativeConfig if={form.model.questions[0].voteCountingType == 2} ref="config" - config={form.model.voteCountingConfig} + config={form.model.questions[0].voteCountingConfig} disabled={form.hasVotes || form.model.closed}/> - <MajorityJudgmentConfig if={form.model.voteCountingType == 8} + <MajorityJudgmentConfig if={form.model.questions[0].voteCountingType == 8} ref="config" - config={form.model.voteCountingConfig} + config={form.model.questions[0].voteCountingConfig} disabled={form.hasVotes || form.model.closed}/> </div> </div> @@ -381,8 +381,8 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; this.installBundle(this.session, this.i18nprefix); this.form = this.opts.form; - if (!this.form.model.voteCountingType) { - this.form.model.voteCountingType = "1"; + if (!this.form.model.questions[0].voteCountingType) { + this.form.model.questions[0].voteCountingType = "1"; } this.showOptions = this.form.showOptions; @@ -394,8 +394,8 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; this.limitEmail = this.form.model.emailAddressSuffixes && this.form.model.emailAddressSuffixes.length; this.on("mount", () => { - this.refs["voteCountingType" + this.form.model.voteCountingType].checked = true; - this.refs.voteCountingType.value = this.form.model.voteCountingType; + this.refs["voteCountingType" + this.form.model.questions[0].voteCountingType].checked = true; + this.refs.voteCountingType.value = this.form.model.questions[0].voteCountingType; this.updateVoteCountingTypeHelp(); this.refs["pollType_" + this.form.model.pollType].focus(); }); @@ -416,7 +416,7 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; }; this.updateVoteCountingTypeHelp = () => { - this.refs.voteCountingTypeHelper.innerHTML = this.voteCountingTypes.get(this.form.model.voteCountingType.toString()).helper; + this.refs.voteCountingTypeHelper.innerHTML = this.voteCountingTypes.get(this.form.model.questions[0].voteCountingType.toString()).helper; this.update(); }; @@ -470,9 +470,9 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; this.voteCountingTypeChanged = e => { if (e.item) { - this.form.model.voteCountingType = e.item.type.id.toString(); + this.form.model.questions[0].voteCountingType = e.item.type.id.toString(); } else { - this.form.model.voteCountingType = e.target.value; + this.form.model.questions[0].voteCountingType = e.target.value; } this.updateVoteCountingTypeHelp(); }; @@ -514,16 +514,16 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; this.form.setSettingsDefault(); } else { if (!this.form.hasVotes) { - this.form.model.addChoices = this.refs.addChoices.checked; - this.form.model.beginChoiceDate = this.refs.addChoices.checked ? this.refs.beginChoiceDate.getValue() : undefined; - this.form.model.endChoiceDate = this.refs.addChoices.checked ? this.refs.endChoiceDate.getValue() : undefined; + this.form.model.questions[0].addChoices = this.refs.addChoices.checked; + this.form.model.questions[0].beginChoiceDate = this.refs.addChoices.checked ? this.refs.beginChoiceDate.getValue() : undefined; + this.form.model.questions[0].endChoiceDate = this.refs.addChoices.checked ? this.refs.endChoiceDate.getValue() : undefined; this.form.model.beginDate = this.refs.votePeriod && this.refs.votePeriod.checked ? this.refs.beginDate.getValue() : undefined; this.form.model.voteVisibility = this.refs.voteVisibility ? this.refs.voteVisibility.value : 'EVERYBODY'; this.form.model.anonymousVoteAllowed = this.refs.anonymousVote ? this.refs.anonymousVote.checked : false; this.form.model.resultVisibility = this.refs.resultVisibility ? this.refs.resultVisibility.value : 'EVERYBODY'; this.form.model.commentVisibility = this.refs.commentVisibility ? this.refs.commentVisibility.value : 'EVERYBODY'; - this.form.model.voteCountingConfig = this.refs.config && typeof this.refs.config.getConfig === "function" ? this.refs.config.getConfig() : {}; + this.form.model.questions[0].voteCountingConfig = this.refs.config && typeof this.refs.config.getConfig === "function" ? this.refs.config.getConfig() : {}; } this.form.model.endDate = this.refs.votePeriod.checked ? this.refs.endDate.getValue() : undefined; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit d56fd5ef1fd6fab68f198c0bea87c0724e09bf55 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 15:58:44 2019 +0200 refs #248 update gitlab-ci configuration --- .gitlab-ci.yml | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7dedc2ea..52a7a55a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ stages: - build -- demo +- docker - pages - release - sonar @@ -32,21 +32,20 @@ build-js: except: - schedules -demo: - image: registry.nuiton.org/codelutin/dockerfiles:docker - stage: demo - when: manual - script: - - docker build --no-cache -t registry.nuiton.org/chorem/pollen -f Dockerfile . - - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nuiton.org - - docker push registry.nuiton.org/chorem/pollen - - docker logout registry.nuiton.org - dependencies: - - build-java - - build-js - tags: - - docker - - docker-feature +#demo: +# image: registry.nuiton.org/codelutin/dockerfiles:docker +# stage: demo +# when: manual +# script: +# - docker build --no-cache -t registry.nuiton.org/chorem/pollen -f Dockerfile . +# - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nuiton.org +# - docker push registry.nuiton.org/chorem/pollen +# - docker logout registry.nuiton.org +# dependencies: +# - build-java +# - build-js +# tags: +# - docker release: image: registry.nuiton.org/codelutin/dockerfiles:maven-release-with-frequent-libraries @@ -137,7 +136,7 @@ sonar_job_ui: only: - schedules -docker: +docker:latest: image: registry.nuiton.org/codelutin/dockerfiles:docker stage: release when: manual @@ -161,7 +160,7 @@ docker: tags: - docker -docker-feature: +docker:feature: image: registry.nuiton.org/codelutin/dockerfiles:docker stage: release when: manual @@ -182,7 +181,7 @@ docker-feature: - build-java - build-js tags: - - docker-feature + - docker pages: image: python:alpine -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 44ac4e8f5b2cb89e5b1797745a1ee2b0f0e134a8 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 16:38:35 2019 +0200 refs #248 update gitlab-ci configuration --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 52a7a55a..0b0b1177 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -138,7 +138,7 @@ sonar_job_ui: docker:latest: image: registry.nuiton.org/codelutin/dockerfiles:docker - stage: release + stage: docker when: manual only: - /^(pollen-)?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?$/i @@ -162,7 +162,7 @@ docker:latest: docker:feature: image: registry.nuiton.org/codelutin/dockerfiles:docker - stage: release + stage: docker when: manual only: - /^feature.*$/ -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit f1186876dec772a5b9e4b62c4f49f17aad5512a0 Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 16:52:15 2019 +0200 refs #248 update gitlab-ci configuration sur docker:feature --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b0b1177..eba6565c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -174,7 +174,7 @@ docker:feature: name: "${CI_BUILD_REF_NAME}" script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nuiton.org - - docker build --no-cache --file Dockerfile-latest -t registry.nuiton.org/chorem/pollen:${CI_COMMIT_REF_NAME#feature/} . + - docker build --no-cache -t registry.nuiton.org/chorem/pollen:${CI_COMMIT_REF_NAME#feature/} -f Dockerfile . - docker push registry.nuiton.org/chorem/pollen:${CI_COMMIT_REF_NAME#feature/} - docker logout registry.nuiton.org dependencies: -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 758c34fadde4e9cfbc452d3679f42a0c5b8bc00d Author: dcosse <cosse@codelutin.com> Date: Tue Oct 8 16:53:57 2019 +0200 refs #248 update gitlab-ci configuration on docker:feature, update artifact name --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eba6565c..fd930b58 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -171,7 +171,7 @@ docker:feature: - pollen-rest-api/target/pollen-rest-api-*.war - pollen-ui-riot-js/target/dist expire_in: 1 day - name: "${CI_BUILD_REF_NAME}" + name: "${CI_COMMIT_REF_NAME}" script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nuiton.org - docker build --no-cache -t registry.nuiton.org/chorem/pollen:${CI_COMMIT_REF_NAME#feature/} -f Dockerfile . -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 78c3b2fe39f949b74a25c46368adb6b2c353795b Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 09:32:42 2019 +0200 refs #248 update gitlab-ci configuration remove commented block --- .gitlab-ci.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd930b58..34a609c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,21 +32,6 @@ build-js: except: - schedules -#demo: -# image: registry.nuiton.org/codelutin/dockerfiles:docker -# stage: demo -# when: manual -# script: -# - docker build --no-cache -t registry.nuiton.org/chorem/pollen -f Dockerfile . -# - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nuiton.org -# - docker push registry.nuiton.org/chorem/pollen -# - docker logout registry.nuiton.org -# dependencies: -# - build-java -# - build-js -# tags: -# - docker - release: image: registry.nuiton.org/codelutin/dockerfiles:maven-release-with-frequent-libraries stage: release -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 84f61c6117e64b28c0692da055ecdc1deb7221ff Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 09:43:15 2019 +0200 refs #248 improve readable --- pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html index 05b6cf8e..d21141f7 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html @@ -76,9 +76,8 @@ this.on("mount", () => { let choiceDrag = this.refs.choicesDrag && Array.isArray(this.refs.choicesDrag) ? this.refs.choicesDrag : []; - let choices = (choiceDrag) - .sort((c1, c2) => Math.sign(c1.choice.choiceOrder - c2.choice.choiceOrder)) - .map(c => c.refs.choice); + let choices = choiceDrag .sort((c1, c2) => Math.sign(c1.choice.choiceOrder - c2.choice.choiceOrder)) + .map(c => c.refs.choice); choices[0] && choices[0].focus(); this.placeChoices(true); }); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 5d88fdf40ccdab5c7279e6a99fb9d8a87175169e Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 09:43:36 2019 +0200 refs #248 improve space --- pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html index d21141f7..2f018010 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html @@ -76,8 +76,8 @@ this.on("mount", () => { let choiceDrag = this.refs.choicesDrag && Array.isArray(this.refs.choicesDrag) ? this.refs.choicesDrag : []; - let choices = choiceDrag .sort((c1, c2) => Math.sign(c1.choice.choiceOrder - c2.choice.choiceOrder)) - .map(c => c.refs.choice); + let choices = choiceDrag.sort((c1, c2) => Math.sign(c1.choice.choiceOrder - c2.choice.choiceOrder)) + .map(c => c.refs.choice); choices[0] && choices[0].focus(); this.placeChoices(true); }); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 8933f082d59dbffb43a0b5b6db2e57eeba1e42a6 Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 17:06:16 2019 +0200 refs #249 add poolType as saveVoters parameters to as current pooltype change and not previous one. List validation review to fix validation not working --- .../pollen/rest/api/beans/VoterListSaveBean.java | 11 +++ .../chorem/pollen/rest/api/v1/VoterListApi.java | 6 +- .../pollen/services/service/VoterListService.java | 87 +++++++++++----------- .../src/main/web/js/VoterListService.js | 4 +- 4 files changed, 63 insertions(+), 45 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/beans/VoterListSaveBean.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/beans/VoterListSaveBean.java index f54697a8..b6d053b2 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/beans/VoterListSaveBean.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/beans/VoterListSaveBean.java @@ -21,6 +21,7 @@ package org.chorem.pollen.rest.api.beans; * #L% */ +import org.chorem.pollen.persistence.entity.PollType; import org.chorem.pollen.services.bean.VoterListBean; import org.chorem.pollen.services.bean.VoterListMemberBean; @@ -28,6 +29,8 @@ import org.chorem.pollen.services.bean.VoterListMemberBean; * @author Sylvain Bavencoff - bavencoff@codelutin.com */ public class VoterListSaveBean { + + protected PollType pollType; protected VoterListBean[] listsToSave; @@ -68,4 +71,12 @@ public class VoterListSaveBean { public void setMembersToDelete(VoterListMemberBean[] membersToDelete) { this.membersToDelete = membersToDelete; } + + public PollType getPollType() { + return pollType; + } + + public void setPollType(PollType pollType) { + this.pollType = pollType; + } } diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java index 50dd0a2a..042cb74e 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListApi.java @@ -23,6 +23,7 @@ package org.chorem.pollen.rest.api.v1; import com.google.common.collect.Lists; import org.chorem.pollen.persistence.entity.Poll; +import org.chorem.pollen.persistence.entity.PollType; import org.chorem.pollen.persistence.entity.VoterList; import org.chorem.pollen.persistence.entity.VoterListMember; import org.chorem.pollen.rest.api.beans.VoterListSaveBean; @@ -81,6 +82,8 @@ public class VoterListApi { @PathParam("pollId") PollenEntityId<Poll> pollId, VoterListSaveBean voterListSaveBean) throws InvalidFormException { List<String> listIds = Lists.newLinkedList(); + PollType pollType = voterListSaveBean.getPollType(); + for (VoterListBean list : voterListSaveBean.getListsToDelete()) { listIds.add(list.getEntityId()); } @@ -94,7 +97,8 @@ public class VoterListApi { Lists.newArrayList(voterListSaveBean.getListsToSave()), Lists.newArrayList(voterListSaveBean.getMembersToSave()), listIds, - memberIds); + memberIds, + pollType); } @Path("/polls/{pollId}/voterLists/{voterListId}") diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java index 32e5b05c..f4c00112 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java @@ -28,6 +28,7 @@ import com.google.common.collect.Sets; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.tuple.Pair; import org.chorem.pollen.persistence.entity.Poll; +import org.chorem.pollen.persistence.entity.PollType; import org.chorem.pollen.persistence.entity.PollenPrincipal; import org.chorem.pollen.persistence.entity.PollenUser; import org.chorem.pollen.persistence.entity.Question; @@ -200,7 +201,7 @@ public class VoterListService extends PollenServiceSupport { Collections.singletonList(voterList), members, Collections.emptyList(), - Collections.emptyList()); + Collections.emptyList(), null); VoterList result = getVoterListDao().forTopiaIdEquals(voterList.getEntityId()).findUnique(); @@ -218,7 +219,7 @@ public class VoterListService extends PollenServiceSupport { Collections.singletonList(voterList), Collections.emptyList(), Collections.emptyList(), - Collections.emptyList()); + Collections.emptyList(), null); VoterList result = getVoterListDao().forTopiaIdEquals(voterList.getEntityId()).findUnique(); @@ -336,7 +337,7 @@ public class VoterListService extends PollenServiceSupport { Collections.emptyList(), Collections.singletonList(member), Collections.emptyList(), - Collections.emptyList()); + Collections.emptyList(), null); VoterListMember result = getVoterListMemberDao().forTopiaIdEquals(member.getEntityId()).findUnique(); return toVoterListMemberBean(result); @@ -353,7 +354,7 @@ public class VoterListService extends PollenServiceSupport { Collections.emptyList(), Collections.singletonList(member), Collections.emptyList(), - Collections.emptyList()); + Collections.emptyList(), null); VoterListMember result = getVoterListMemberDao().forTopiaIdEquals(member.getEntityId()).findUnique(); return toVoterListMemberBean(result); @@ -371,7 +372,7 @@ public class VoterListService extends PollenServiceSupport { Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), - Collections.singletonList(memberId)); + Collections.singletonList(memberId), null); } @@ -540,9 +541,12 @@ public class VoterListService extends PollenServiceSupport { checkNotBlank(errors, VoterList.PROPERTY_NAME, voterList.getName(), l(getLocale(), "pollen.error.voterList.name.mandatory")); check(errors, VoterList.PROPERTY_WEIGHT, voterList.getWeight() > 0, l(getLocale(), "pollen.error.voterList.weight.greaterThan0")); - if (subLists.isEmpty()) { - checkNotEmpty(errors, "member", members, l(getLocale(), "pollen.error.voterList.member.mandatory")); - } + + final boolean condition = subLists.stream().noneMatch(voterListBean -> voterListBean.getCountMembers() == 0); + check(errors, "member", + condition, + l(getLocale(), "pollen.error.voterList.member.mandatory")); + boolean nameAlreadyUse = sisterNames.contains(voterList.getName()); check(errors, VoterList.PROPERTY_NAME, !nameAlreadyUse, l(getLocale(), "pollen.error.voterList.name.alreadyUsed")); @@ -604,15 +608,24 @@ public class VoterListService extends PollenServiceSupport { List<VoterListBean> listsToSave, List<VoterListMemberBean> membersToSave, List<String> listIdsToDelete, - List<String> memberIdsToDelete) throws InvalidFormException { + List<String> memberIdsToDelete, + PollType pollType) throws InvalidFormException { checkIsConnectedRequired(); checkNotNull(pollId); Poll poll = getPollService().getPoll0(pollId); checkPermission(PollenPermissions.edit(poll)); - - checkVoters(poll, listsToSave, membersToSave); + + // when reaching this code Poll may no be accurate, if user change the poll type the persisted PollType may have + // the previous one. Getting the pool type from args force make sure to use the correct one + // and process the correct validation process + // see bug ref#249 + PollType forcePollType = pollType != null ? pollType : poll.getPollType(); + if (forcePollType == PollType.RESTRICTED) { + checkVoters(poll, listsToSave, membersToSave); + } + checkNotNull(listIdsToDelete); checkNotNull(memberIdsToDelete); @@ -669,49 +682,37 @@ public class VoterListService extends PollenServiceSupport { checkNotNull(membersToSave); // verification des listes de voteurs Map<PollenEntityId<VoterList>, Set<String>> listNameByParentId = Maps.newHashMap(); + + // use to load existing member names + // do not load the name from the members ids that we want to save otherwise they will be consider as duplicated. + Set<String> idsToIgnore = listsToSave.stream().map(VoterListBean::getEntityId).collect(Collectors.toSet()); for (VoterListBean voterList : listsToSave) { - + + List<VoterListMemberBean> members; + List<VoterListBean> subLists; + + members = membersToSave.stream() + .filter(member -> voterList.getId().equals(member.getVoterListId())) + .collect(Collectors.toList()); + + subLists = listsToSave.stream() + .filter(list -> voterList.getId().equals(list.getParentId())) + .collect(Collectors.toList()); + Set<String> sisterNames = listNameByParentId.computeIfAbsent(voterList.getParentId(), parentId -> { if (poll == null || parentId.isNotEmpty() || parentId.isTemporaryId()) { return Sets.newHashSet(); } else { + // do not load names of not new list as they will be consider as duplicated List<VoterList> existingVoterLists = getVoterLists0(poll, parentId.getEntityId()); - return existingVoterLists.stream() + return existingVoterLists.stream() + .filter(voterList0 -> !idsToIgnore.contains(voterList0.getTopiaId())) .map(VoterList::getName) .collect(Collectors.toSet()); } }); - List<VoterListMemberBean> members = Collections.emptyList(); - List<VoterListBean> subLists = Collections.emptyList(); - - - if (voterList.isTemporaryId()) { - - members = membersToSave.stream() - .filter(member -> voterList.getId().equals(member.getVoterListId())) - .collect(Collectors.toList()); - - subLists = listsToSave.stream() - .filter(list -> voterList.getId().equals(list.getParentId())) - .collect(Collectors.toList()); - - } else if (voterList.isPersisted()) { - - VoterList oldVoterList = getVoterList0(poll, voterList.getEntityId()); - sisterNames.remove(oldVoterList.getName()); - - List<VoterListMember> existingVoterListMembers = getVoterListMembers0(voterList.getEntityId()); - members = toBeanList(existingVoterListMembers, this::toVoterListMemberBean); - List<VoterList> existingSubVoterLists = getVoterLists0(poll, voterList.getEntityId()); - subLists = toBeanList(existingSubVoterLists, this::toVoterListBean); - } else if (listsToSave.size() == 1){ - - members = membersToSave; - - } - ErrorMap errorMap = checkVoterList(sisterNames, voterList, members, subLists); errorMap.failIfNotEmpty(); @@ -742,7 +743,7 @@ public class VoterListService extends PollenServiceSupport { Set<String> brotherNames = brotherNamesEmails.getLeft(); Set<String> brotherEmails = brotherNamesEmails.getLeft(); - if (voterListMember.isPersisted()) { + if (voterListMember.isPersisted() && poll != null) { VoterList voterList = getVoterList0(poll, voterListMember.getVoterListId().getEntityId()); diff --git a/pollen-ui-riot-js/src/main/web/js/VoterListService.js b/pollen-ui-riot-js/src/main/web/js/VoterListService.js index 5890748f..e7244780 100644 --- a/pollen-ui-riot-js/src/main/web/js/VoterListService.js +++ b/pollen-ui-riot-js/src/main/web/js/VoterListService.js @@ -267,7 +267,8 @@ class VoterListService extends FetchService { id: voterlist.id, parentId: voterlist.parentId, name: voterlist.name, - weight: voterlist.weight + weight: voterlist.weight, + countMembers : voterlist.countMembers }; }); } @@ -295,6 +296,7 @@ class VoterListService extends FetchService { let url = this._getUrlPrefix(this.pollForm.model.id); return this.put(url, { + pollType: this.pollForm.model.pollType, listsToSave: this.getVoterLists(), membersToSave: this.getVoterListMembers(), listsToDelete: this.voterListsToDelete, -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 247025bda9d5609f6811e72662065eacdf97f9d7 Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 17:44:18 2019 +0200 refs #249 fix issue on empty list check --- .../java/org/chorem/pollen/services/service/VoterListService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java index f4c00112..49cbe5bd 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoterListService.java @@ -542,7 +542,13 @@ public class VoterListService extends PollenServiceSupport { checkNotBlank(errors, VoterList.PROPERTY_NAME, voterList.getName(), l(getLocale(), "pollen.error.voterList.name.mandatory")); check(errors, VoterList.PROPERTY_WEIGHT, voterList.getWeight() > 0, l(getLocale(), "pollen.error.voterList.weight.greaterThan0")); - final boolean condition = subLists.stream().noneMatch(voterListBean -> voterListBean.getCountMembers() == 0); + boolean condition; + if (subLists.size() == 0 && voterList.getCountMembers() == 0) { + condition = false; + } else { + condition = subLists.stream().noneMatch(voterListBean -> voterListBean.getCountMembers() == 0); + } + check(errors, "member", condition, l(getLocale(), "pollen.error.voterList.member.mandatory")); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 27263fd94ee2f23fb4efd4bde184282b9c17916c Author: dcosse <cosse@codelutin.com> Date: Wed Oct 9 17:44:31 2019 +0200 refs #249 update TU --- .../java/org/chorem/pollen/services/service/VoterListServiceTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java index a3152947..59af0d6d 100644 --- a/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java +++ b/pollen-services/src/test/java/org/chorem/pollen/services/service/VoterListServiceTest.java @@ -215,6 +215,8 @@ public class VoterListServiceTest extends AbstractPollenServiceTest { member.setName("member1"); member.setEmail("member1@pollen.org"); member.setWeight(1); + + voterList.setCountMembers(1); listMember.add(member); PollenEntityRef<VoterList> voterListPersisted = voterListService.addVoterList(pollId, voterList, listMember); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm