123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- {
- "id": "dfb0059f3e45411d973951e122ddf1be",
- "defaultTitle": "PR_AB",
- "defaultDescription": "PR_AB",
- "alias": "PR_AB",
- "electionEvent": {
- "id": "6eb1403ab44d4fedb86a6f73adcf17fc"
- },
- "template": "listsAndCandidates",
- "fullBlank": "true",
- "options": [
- {
- "id": "84106a8b84104ef8a5bea3a9f748fd2c",
- "representation": "100673",
- "attribute": "7defa20679bc4582a1efcc7b33aed45a"
- },
- {
- "id": "670db19029274b99a8a6795fab43c476",
- "representation": "10069",
- "attribute": "e009fda34d674273bfd187b43c409a44"
- },
- {
- "id": "e10518b168214f779736bef5d5a7ab9d",
- "representation": "100613",
- "attribute": "b09d8da03cbb49b785207080e66e338b"
- },
- {
- "id": "3449e8e4a0ca4904bf9e05b248c73301",
- "representation": "100559",
- "attribute": "85bb39c30ba14d29999bd272da0412dd"
- },
- {
- "id": "8ffd9fc3c1544e4cbb80b2bb265eaf11",
- "representation": "100549",
- "attribute": "6d735c50a81e4b24b9fc721c6b18f82c"
- }
- ],
- "attributes": [
- {
- "id": "3e4cd5337e204f5591808887fa2cea02",
- "alias": "candidates",
- "correctness": true,
- "related": []
- },
- {
- "id": "7defa20679bc4582a1efcc7b33aed45a",
- "alias": "Blank Candidate",
- "correctness": false,
- "related": [
- "3e4cd5337e204f5591808887fa2cea02"
- ]
- },
- {
- "id": "9053f1203ecf4281b220b9c385c3c18e",
- "alias": "PR_AB1",
- "correctness": false,
- "related": []
- },
- {
- "id": "e009fda34d674273bfd187b43c409a44",
- "alias": "PR_AB11id",
- "correctness": false,
- "related": [
- "9053f1203ecf4281b220b9c385c3c18e",
- "3e4cd5337e204f5591808887fa2cea02"
- ]
- },
- {
- "id": "b09d8da03cbb49b785207080e66e338b",
- "alias": "PR_AB12id",
- "correctness": false,
- "related": [
- "9053f1203ecf4281b220b9c385c3c18e",
- "3e4cd5337e204f5591808887fa2cea02"
- ]
- },
- {
- "id": "980cd86438a048e78737405f34687c05",
- "alias": "PR_AB2",
- "correctness": false,
- "related": []
- },
- {
- "id": "85bb39c30ba14d29999bd272da0412dd",
- "alias": "PR_AB21id",
- "correctness": false,
- "related": [
- "980cd86438a048e78737405f34687c05",
- "3e4cd5337e204f5591808887fa2cea02"
- ]
- },
- {
- "id": "6d735c50a81e4b24b9fc721c6b18f82c",
- "alias": "PR_AB22id",
- "correctness": false,
- "related": [
- "980cd86438a048e78737405f34687c05",
- "3e4cd5337e204f5591808887fa2cea02"
- ]
- }
- ],
- "questions": [
- {
- "id": "5178a35e29cc4874ab817d2653f5a732",
- "max": "1",
- "min": "0",
- "cumul": "1",
- "writeIn": "false",
- "fusions": [],
- "blankAttribute": "7defa20679bc4582a1efcc7b33aed45a",
- "attribute": "3e4cd5337e204f5591808887fa2cea02"
- }
- ],
- "encryptedCorrectnessRule": "function evaluateCorrectness(selection, callbackFunction){if (typeof(callbackFunction)==='undefined') { callbackFunction = function (type, reference, extra) {};};var result = true;result = function (subSelection, callbackFunction) {var partialResult = true;var selectionName = 'dfb0059f3e45411d973951e122ddf1be';var attributeName = '3e4cd5337e204f5591808887fa2cea02';var min = 0;var max = 1;var count = 0;for (i = 0; i < subSelection.length; i++) {var submittedOption = subSelection[i];if (submittedOption.indexOf(attributeName) > -1) {count++;}}if (count < min) {callbackFunction('MIN_ERROR', selectionName);partialResult = false;}if (count > max) {callbackFunction('MAX_ERROR', selectionName);partialResult = false;}return partialResult;}(selection, callbackFunction) && result;return result;}",
- "decryptedCorrectnessRule": "function evaluateCorrectness(selection, callbackFunction){if (typeof(callbackFunction)==='undefined') { callbackFunction = function (type, reference, extra) {};};var B64 = {encode: function (r) {return r;},decode: function (r) {return r;}};var encodedSelection = [];for (i = 0; i < selection.length; i++) {encodedSelection.push(B64.encode(selection[i]));}var CorrectnessFunctions = {getRelevantVotingOptions : function (votingOptions, selection){var selectionRelevantVotingOptions = [];for (i = 0; i < selection.length; i++) {if (votingOptions.indexOf(selection[i]) > -1) {selectionRelevantVotingOptions.push(selection[i]);}}return selectionRelevantVotingOptions;},isMaxMatch : function (selectionRelevantVotingOptions, maxReq, selectionName, callbackFunction){var maxMatch = maxReq >= selectionRelevantVotingOptions.length;if (!maxMatch) {callbackFunction('MAX_ERROR', B64.decode(selectionName));}return maxMatch;},isMinMatch : function (selectionRelevantVotingOptions, minReq, selectionName, callbackFunction){var minMatch = minReq <= selectionRelevantVotingOptions.length;if (!minMatch) {callbackFunction('MIN_ERROR', B64.decode(selectionName));}return minMatch;},isMinWithBlankMatch: function (selectionRelevantVotingOptions, minReq, blankOption, selectionName, callbackFunction) {var minMatch = minReq <= selectionRelevantVotingOptions.length - 1;var blankMatch = (selectionRelevantVotingOptions.indexOf(blankOption) > -1) && selectionRelevantVotingOptions.length == 1;if (!(minMatch || blankMatch)) {callbackFunction('MIN_WITH_BLANK_ERROR', B64.decode(selectionName));}return (minMatch || blankMatch);},areAllSelectionsValid: function (globalVotingOptions, encodedSelection, callbackFunction) {var partialResult = true;for (i = 0; i < encodedSelection.length; i++) {var selectionIsValid = globalVotingOptions.indexOf(encodedSelection[i]) > -1;if (!selectionIsValid) {callbackFunction('SELECTION_ERROR', B64.decode(encodedSelection[i]));}partialResult = partialResult && selectionIsValid;}return partialResult;},areAllSelectionsUnique: function (encodedSelection, callbackFunction) {var partialResult = true;var duplicates = encodedSelection.reduce(function(acc, el, i, arr) {if (arr.indexOf(el) !== i && acc.indexOf(el) < 0) acc.push(el); return acc;}, []);if (duplicates.length != 0) {callbackFunction('MULTIPLE_SELECTION_ERROR', B64.decode(encodedSelection[duplicates[0]]));partialResult = false;}return partialResult;},checkAlliance: function (allianceVotingOptions, cumulNumber, encodedSelection, callbackFunction) {var partialResult = true;for (i = 0; i < encodedSelection.length; i++) {for (j = 0; j < allianceVotingOptions.length; j++) {if(allianceVotingOptions[j].indexOf(encodedSelection[i]) > -1){var count = 0;for (k = 0; k < allianceVotingOptions[j].length; k++) {if (encodedSelection.indexOf(allianceVotingOptions[j][k]) > -1) {count++;}}if (count > cumulNumber){callbackFunction('CUMULATION_ERROR', B64.decode(encodedSelection[i]));partialResult = false;}}}}return partialResult;}};var result = true;result = function (subSelection, callbackFunction){var partialResult = true;var selectionName = '7567ab251a51459794b69cd9f517fe17';var votingOptions = ['84106a8b84104ef8a5bea3a9f748fd2c', '670db19029274b99a8a6795fab43c476', 'e10518b168214f779736bef5d5a7ab9d', '3449e8e4a0ca4904bf9e05b248c73301', '8ffd9fc3c1544e4cbb80b2bb265eaf11'];var selectionRelevantVotingOptions = CorrectnessFunctions.getRelevantVotingOptions(votingOptions, subSelection);partialResult = partialResult && CorrectnessFunctions.isMinMatch(selectionRelevantVotingOptions, 1, selectionName, callbackFunction);partialResult = partialResult && CorrectnessFunctions.isMaxMatch(selectionRelevantVotingOptions, 1, selectionName, callbackFunction);return partialResult;}(encodedSelection, callbackFunction) && result;;var globalVotingOptions = ['84106a8b84104ef8a5bea3a9f748fd2c', '670db19029274b99a8a6795fab43c476', 'e10518b168214f779736bef5d5a7ab9d', '3449e8e4a0ca4904bf9e05b248c73301', '8ffd9fc3c1544e4cbb80b2bb265eaf11'];result = CorrectnessFunctions.areAllSelectionsValid(globalVotingOptions, encodedSelection, callbackFunction) && result;result = CorrectnessFunctions.areAllSelectionsUnique(encodedSelection, callbackFunction) && result;return result;}"
- }
|