branch develop updated (0ac67fdf -> 45e84dd0)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 0ac67fdf Merge tag '3.3.7' into develop new 9cae151e fixes #334 - How this feature could have been so badly tested new ccb9aae2 fixes #335 : Wrong poll displayed - There was a useless refresh too soon messing up new 45e84dd0 Better debugging The 3 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 45e84dd0bf432d6df6dea6b312efa1ece85dad6e Author: jcouteau <couteau@codelutin.com> Date: Wed May 13 09:15:01 2020 +0200 Better debugging commit ccb9aae28eaa49fb3b523952297e5737837eb9f1 Author: jcouteau <couteau@codelutin.com> Date: Wed May 13 09:14:30 2020 +0200 fixes #335 : Wrong poll displayed - There was a useless refresh too soon messing up commit 9cae151e2e562ebbdac183644ffee6ce07643c08 Author: jcouteau <couteau@codelutin.com> Date: Wed May 13 09:02:37 2020 +0200 fixes #334 - How this feature could have been so badly tested Summary of changes: .../org/chorem/pollen/rest/api/v1/PollApi.java | 3 +- .../pollen/services/service/PollService.java | 46 +++++++++++++++++----- .../pollen/services/service/QuestionService.java | 3 ++ .../src/main/web/tag/poll/Poll.tag.html | 7 ++-- .../src/main/web/tag/poll/Summary.tag.html | 6 +-- .../src/main/web/tag/poll/Votes.tag.html | 2 +- pollen-ui-riot-js/webpack.config.js | 5 +-- 7 files changed, 50 insertions(+), 22 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 develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 9cae151e2e562ebbdac183644ffee6ce07643c08 Author: jcouteau <couteau@codelutin.com> Date: Wed May 13 09:02:37 2020 +0200 fixes #334 - How this feature could have been so badly tested --- .../org/chorem/pollen/rest/api/v1/PollApi.java | 3 +- .../pollen/services/service/PollService.java | 46 +++++++++++++++++----- .../pollen/services/service/QuestionService.java | 3 ++ .../src/main/web/tag/poll/Poll.tag.html | 6 +-- .../src/main/web/tag/poll/Summary.tag.html | 6 +-- .../src/main/web/tag/poll/Votes.tag.html | 2 +- 6 files changed, 48 insertions(+), 18 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java index 4c64188b..3f975d32 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java @@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils; import org.chorem.pollen.persistence.entity.Choice; import org.chorem.pollen.persistence.entity.ChoiceType; import org.chorem.pollen.persistence.entity.Poll; +import org.chorem.pollen.persistence.entity.Question; import org.chorem.pollen.rest.api.beans.PollCreateBean; import org.chorem.pollen.services.bean.ChoiceBean; import org.chorem.pollen.services.bean.PaginationParameterBean; @@ -198,7 +199,7 @@ public class PollApi { @POST public PollenEntityRef<Choice> addChoice(@Context ChoiceService choiceService, @PathParam("pollId") PollenEntityId<Poll> pollId, - @PathParam("questionId") PollenEntityId<Poll> questionId, + @PathParam("questionId") PollenEntityId<Question> questionId, ChoiceBean choice) throws InvalidFormException { return choiceService.addChoice(pollId.getEntityId(), questionId.getEntityId(), choice); diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java index af67afe4..b029a27a 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java @@ -123,14 +123,12 @@ public class PollService extends PollenServiceSupport { bean.setClosed(false); bean.setStatus(PollBean.PollStatus.CREATED); - //FIXME JC181001 - ADDING_CHOICES toujours pertinent sur le Poll ? - if (PollBean.PollStatus.ADDING_CHOICES != bean.getStatus()) { - Date beginDate = entity.getBeginDate(); - Date endDate = entity.getEndDate(); - if (beginDate != null && now.after(beginDate) && (endDate == null || now.before(endDate))) { - bean.setStatus(PollBean.PollStatus.VOTING); - } + Date beginDate = entity.getBeginDate(); + Date endDate = entity.getEndDate(); + if (beginDate != null && now.after(beginDate) && (endDate == null || now.before(endDate))) { + bean.setStatus(PollBean.PollStatus.VOTING); } + } /* Questions and choices */ @@ -140,6 +138,31 @@ public class PollService extends PollenServiceSupport { bean.setQuestions(questions); } + /* Check adding choices */ + //XXX JC-200512 adding choice status should be on question instead of poll + Date beginAddChoiceDate = null; + Date endAddChoiceDate = null; + Boolean addChoiceEnabled = false; + for(QuestionBean question: bean.getQuestions()) { + addChoiceEnabled = addChoiceEnabled || question.isChoiceAddAllowed(); + if (question.getBeginChoiceDate() != null && (beginAddChoiceDate == null || question.getBeginChoiceDate().before(beginAddChoiceDate))) { + beginAddChoiceDate = question.getBeginChoiceDate(); + } + if (question.getEndChoiceDate() != null && (endAddChoiceDate == null || question.getEndChoiceDate().after(endAddChoiceDate))) { + endAddChoiceDate = question.getEndChoiceDate(); + } + } + + if (addChoiceEnabled && + ( + (beginAddChoiceDate == null && (endAddChoiceDate == null || now.before(endAddChoiceDate))) || + (beginAddChoiceDate != null && now.after(beginAddChoiceDate) && (endAddChoiceDate == null || now.before(endAddChoiceDate))) + ) + ){ + bean.setStatus(PollBean.PollStatus.ADDING_CHOICES); + } + + if (isNotPermitted(PollenPermissions.edit(entity))) { bean.setPermission(null); bean.setCreatorEmail(null); @@ -576,10 +599,13 @@ public class PollService extends PollenServiceSupport { QuestionService questionService = getQuestionService(); for (QuestionBean question : poll.getQuestions()) { - - question.setQuestionOrder(existingQuestions.size()); Question persistedQuestion = questionService.saveQuestion(toSave, question); - existingQuestions.add(persistedQuestion); + existingQuestions.remove(persistedQuestion); + } + + // the remaining questions have been deleted by the user and must be removed + if (CollectionUtils.isNotEmpty(existingQuestions)) { + getQuestionDao().deleteAll(existingQuestions); } } 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 1bfabe84..f72dbdd0 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 @@ -67,6 +67,9 @@ public class QuestionService extends PollenServiceSupport { bean.setCreateDate(entity.getTopiaCreateDate()); bean.setVoteCountingType(entity.getVoteCountingType()); bean.setVoteCountingConfig(getVoteCountingService().getVoteCountingConfig(entity)); + bean.setChoiceAddAllowed(entity.isChoiceAddAllowed()); + bean.setEndChoiceDate(entity.getEndChoiceDate()); + bean.setBeginChoiceDate(entity.getBeginChoiceDate()); /* Choices */ ChoiceService choiceService = getChoiceService(); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html index bad8d44a..1b4f44b9 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html @@ -84,16 +84,16 @@ <p if={poll.endDate}> {_t.dateTo} <span class="brand">{formatDate(poll.endDate)}</span></p> </div> - <div class="left-icon" if={poll.choiceAddAllowed}> + <div class="left-icon" if={poll.questions[0] && poll.questions[0].choiceAddAllowed}> <i class="fa fa-check-square" aria-hidden="true"></i> <p>{_t.dateAddChoices}</p> <p> {poll.endChoiceDate || poll.endDate ? _t.dateFrom : _t.dateFromNoEnd} <span class="brand">{formatDate(poll.beginChoiceDate ? poll.beginChoiceDate : poll.beginDate)}</span> </p> - <p if={poll.endChoiceDate || poll.endDate}> + <p if={poll.questions[0].endChoiceDate || poll.endDate}> {_t.dateTo} - <span class="brand">{formatDate(poll.endChoiceDate ? poll.endChoiceDate : poll.endDate)}</span> + <span class="brand">{formatDate(poll.questions[0].endChoiceDate ? poll.questions[0].endChoiceDate : poll.endDate)}</span> </p> </div> diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html index fee9f4e2..cd46a7f3 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html @@ -48,10 +48,10 @@ <div class="summary-part"> <h3>{_t.dates}</h3> - <div if={opts.form.model.choiceAddAllowed}> + <div if={opts.form.model.questions[0].choiceAddAllowed}> {_t.addingChoices} - <span if={opts.form.model.beginChoiceDate}>{_t.fromDate} <strong>{formatDate(opts.form.model.beginChoiceDate)}</strong></span> - <span if={opts.form.model.endChoiceDate}> {_t.toDate} <strong>{formatDate(opts.form.model.endChoiceDate)}</strong></span> + <span if={opts.form.model.questions[0].beginChoiceDate}>{_t.fromDate} <strong>{formatDate(opts.form.model.questions[0].beginChoiceDate)}</strong></span> + <span if={opts.form.model.questions[0].endChoiceDate}> {_t.toDate} <strong>{formatDate(opts.form.model.questions[0].endChoiceDate)}</strong></span> </div> <div> {_t.voting} diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index d2cbb4cb..e60b7832 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -156,7 +156,7 @@ this.update(); this.refs.choice.submit(); - this.poll.addChoice(this.choiceToAdd).then(() => { + this.poll.addChoice(this.poll.questions[0].id, this.choiceToAdd).then(() => { this.addingChoice = false; this.choiceToAdd = this.poll.initChoice(this.choiceToAdd); this.refs.choice.updateChoice(); -- 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 develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit ccb9aae28eaa49fb3b523952297e5737837eb9f1 Author: jcouteau <couteau@codelutin.com> Date: Wed May 13 09:14:30 2020 +0200 fixes #335 : Wrong poll displayed - There was a useless refresh too soon messing up --- pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html | 1 - 1 file changed, 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html index 1b4f44b9..7e5d10e0 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html @@ -243,7 +243,6 @@ } }; - this.refresh(); this.intervalId = window.setInterval(this.refresh, 60000); this.on("unmount", () => { -- 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 develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 45e84dd0bf432d6df6dea6b312efa1ece85dad6e Author: jcouteau <couteau@codelutin.com> Date: Wed May 13 09:15:01 2020 +0200 Better debugging --- pollen-ui-riot-js/webpack.config.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pollen-ui-riot-js/webpack.config.js b/pollen-ui-riot-js/webpack.config.js index 68d5ace0..d4b35f88 100644 --- a/pollen-ui-riot-js/webpack.config.js +++ b/pollen-ui-riot-js/webpack.config.js @@ -10,7 +10,8 @@ module.exports = { output: { filename: "[name].js", - path: __dirname + "/target/dist/" + path: __dirname + "/target/dist/", + sourceMapFilename: "[name].js.map" }, plugins: [ @@ -39,8 +40,6 @@ module.exports = { ]) ], - devtool: "source-map", - module: { rules: [ { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm