From 83e16b0b0955250d56a8f99439d7f6d6476026d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Mon, 30 Jan 2017 21:33:41 +0100 Subject: [PATCH] Fixed wrong order of assignment votes caused by redis cache. --- .../assignments/static/js/assignments/base.js | 19 +++++++++++++++++-- .../assignments/slide_assignment.html | 4 ++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/openslides/assignments/static/js/assignments/base.js b/openslides/assignments/static/js/assignments/base.js index 719c6c880..e09cd9135 100644 --- a/openslides/assignments/static/js/assignments/base.js +++ b/openslides/assignments/static/js/assignments/base.js @@ -33,7 +33,8 @@ angular.module('OpenSlidesApp.assignments', []) _.forEach(this.votes, function (vote) { // Initial values for the vote - var value = '', + var order = '', + value = '', percentStr = '', percentNumber; @@ -52,6 +53,19 @@ angular.module('OpenSlidesApp.assignments', []) value = 0; // Vote was not defined. Set value to 0. } } + switch (vote.value) { + case "Yes": + order = 1; + break; + case "No": + order = 2; + break; + case "Abstain": + order = 3; + break; + default: + order = 0; + } // Special case where to skip percents var skipPercents = config === 'YES_NO' && vote.value === 'Abstain'; @@ -61,13 +75,14 @@ angular.module('OpenSlidesApp.assignments', []) percentStr = "(" + percentNumber + "%)"; } votes.push({ + 'order': order, 'label': gettextCatalog.getString(vote.value), 'value': value, 'percentStr': percentStr, 'percentNumber': percentNumber }); }); - return votes; + return _.sortBy(votes, 'order'); }, // Returns 0 or positive integer if quorum is reached or surpassed. diff --git a/openslides/assignments/static/templates/assignments/slide_assignment.html b/openslides/assignments/static/templates/assignments/slide_assignment.html index 0973e7a9b..7882302dd 100644 --- a/openslides/assignments/static/templates/assignments/slide_assignment.html +++ b/openslides/assignments/static/templates/assignments/slide_assignment.html @@ -48,11 +48,11 @@
- {{ votes[0].label }}: {{ votes[0].value }} · + {{ votes[0].label }}: {{ votes[0].value }} · {{ votes[1].label }}: {{ votes[1].value }} · {{ votes[2].label }}: {{ votes[2].value }} - {{ votes[0].label }}: {{ votes[0].value }} · + {{ votes[0].label }}: {{ votes[0].value }} · {{ votes[1].label }}: {{ votes[1].value }}