{
  "id": "e133300f6a124ca8aea3fd7c935b18e0",
  "defaultTitle": "dd-ab",
  "defaultDescription": "dd-ab",
  "alias": "dd-ab",
  "electionEvent": {
    "id": "6eb1403ab44d4fedb86a6f73adcf17fc"
  },
  "template": "options",
  "fullBlank": "false",
  "options": [
    {
      "id": "c6897cc6f7f04df393a4ec9bf388970c",
      "representation": "100103",
      "attribute": "95331a0df37e44299a28d64d9ca6ba2e"
    },
    {
      "id": "491280b4d21a45c2bc35445d8803ff58",
      "representation": "10009",
      "attribute": "b4f8afb4d56b449cbcd1ae28b94300ee"
    }
  ],
  "attributes": [
    {
      "id": "f9f3b581f27a43789f42f4841002d319",
      "alias": "dd-ab",
      "correctness": true,
      "related": []
    },
    {
      "id": "95331a0df37e44299a28d64d9ca6ba2e",
      "alias": "dd-ab1",
      "correctness": false,
      "related": [
        "f9f3b581f27a43789f42f4841002d319"
      ]
    },
    {
      "id": "b4f8afb4d56b449cbcd1ae28b94300ee",
      "alias": "Blank",
      "correctness": false,
      "related": [
        "2ad28ae479a645e39936aa14aac81372",
        "f9f3b581f27a43789f42f4841002d319"
      ]
    }
  ],
  "questions": [
    {
      "id": "50e2e005c2c0413a96cd6b36e659fae0",
      "max": "1",
      "min": "0",
      "cumul": "1",
      "writeIn": "false",
      "fusions": [],
      "blankAttribute": "b4f8afb4d56b449cbcd1ae28b94300ee",
      "attribute": "f9f3b581f27a43789f42f4841002d319"
    }
  ],
  "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 = 'e133300f6a124ca8aea3fd7c935b18e0';var attributeName = 'f9f3b581f27a43789f42f4841002d319';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 = '50e2e005c2c0413a96cd6b36e659fae0';var votingOptions = ['c6897cc6f7f04df393a4ec9bf388970c', '491280b4d21a45c2bc35445d8803ff58'];var selectionRelevantVotingOptions = CorrectnessFunctions.getRelevantVotingOptions(votingOptions, subSelection);partialResult = partialResult && CorrectnessFunctions.isMinMatch(selectionRelevantVotingOptions, 0, selectionName, callbackFunction);partialResult = partialResult && CorrectnessFunctions.isMaxMatch(selectionRelevantVotingOptions, 1, selectionName, callbackFunction);return partialResult;}(encodedSelection, callbackFunction) && result;;var globalVotingOptions = ['c6897cc6f7f04df393a4ec9bf388970c', '491280b4d21a45c2bc35445d8803ff58'];result = CorrectnessFunctions.areAllSelectionsValid(globalVotingOptions, encodedSelection, callbackFunction) && result;result = CorrectnessFunctions.areAllSelectionsUnique(encodedSelection, callbackFunction) && result;return result;}"
}
