diff --git a/exam-server/main.py b/exam-server/main.py
index ca997d27..eafd6ae9 100644
--- a/exam-server/main.py
+++ b/exam-server/main.py
@@ -38,6 +38,9 @@ def update_cache():
with open("static/index.html") as f:
main_html = f.read()
+ if getenv("ENV") == "dev":
+ main_html = main_html.replace("production.min", "development")
+
with open("static/main.js") as f:
main_js = f.read()
diff --git a/examtool/examtool/api/convert.py b/examtool/examtool/api/convert.py
index fec6b86d..6a423c92 100644
--- a/examtool/examtool/api/convert.py
+++ b/examtool/examtool/api/convert.py
@@ -9,7 +9,7 @@
from examtool.api.utils import list_to_dict, IDFactory
-VERSION = 2 # increment when backward-incompatible changes are made
+VERSION = 3 # increment when backward-incompatible changes are made
def html_convert(x):
diff --git a/examtool/examtool/api/scramble.py b/examtool/examtool/api/scramble.py
index 937352cb..bc778c25 100644
--- a/examtool/examtool/api/scramble.py
+++ b/examtool/examtool/api/scramble.py
@@ -46,7 +46,7 @@ def scramble_group_children():
)
get_elements(group)[:] = elements
- if version > 1:
+ if version >= 2:
scramble_group_children()
if is_compressible_group(group):
@@ -62,6 +62,8 @@ def scramble_group_children():
out.append(element)
return out
+ add_entropy(group)
+
return [group]
def scramble_question(question, substitutions, config):
@@ -100,6 +102,8 @@ def scramble_question(question, substitutions, config):
else:
question.pop("solution", None)
+ add_entropy(question)
+
return question
def substitute(target: dict, list_substitutions, attrs, *, store=True):
@@ -137,6 +141,10 @@ def scramble_keep_fixed(objects):
for i, object in zip(movable_object_pos, movable_object_values):
objects[i] = object
+ def add_entropy(element):
+ if version >= 3:
+ element["entropy"] = hex(random.randrange(2 ** 30))
+
global_substitutions = select_substitutions(exam)
exam["config"]["scramble_groups"] = exam["config"].get(
"scramble_groups", [-1]
diff --git a/examtool_web_common/js/ElementEntropy.js b/examtool_web_common/js/ElementEntropy.js
new file mode 100644
index 00000000..7500140d
--- /dev/null
+++ b/examtool_web_common/js/ElementEntropy.js
@@ -0,0 +1,11 @@
+import React from "react";
+
+export default function ElementEntropy({ entropy }) {
+ return (
+ entropy != null && (
+
+ [version {entropy}]
+
+ )
+ );
+}
diff --git a/examtool_web_common/js/Exam.js b/examtool_web_common/js/Exam.js
index 378f6c30..0c428549 100644
--- a/examtool_web_common/js/Exam.js
+++ b/examtool_web_common/js/Exam.js
@@ -4,6 +4,7 @@ import { typeset } from "MathJax";
import { Col, Jumbotron, Row } from "react-bootstrap";
import Anchor from "./Anchor";
import { inAdminMode } from "./auth";
+import ElementEntropy from "./ElementEntropy";
import ExamContext from "./ExamContext";
import Points from "./Points";
import Question from "./Question";
@@ -94,6 +95,7 @@ export function Group({ group, number, small }) {