Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front_end/messages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@
"zeroPointError0": "Nulový bod není podporován pro diskrétní otázky",
"zeroPointError1": "Nulový bod ({zeroPoint}) by neměl být mezi min ({min}) a max ({max})",
"stepError0": "Krok nemůže být větší než polovina rozsahu: ({halfRange})",
"stepError1": "Krok musí být alespoň 1/200 rozsahu: ({rangePortion})",
"stepError1": "Krok musí být alespoň 1/200 rozsahu: ({rangePortion}). Otázky s více než 200 možnými výsledky by měly být spojité",
"minMaxError0": "Zadejte správné hodnoty min a max",
"minMaxError1": "Minimální hodnota by měla být menší než maximální hodnota",
"rangeWarning0": "Upozornění: Krok nedělí rozsah rovnoměrně. Max snížen na {newMax}",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@
"zeroPointError0": "Zero point is not supported for discrete questions",
"zeroPointError1": "Zero point ({zeroPoint}) should not be between min ({min}) and max ({max})",
"stepError0": "Step cannot be more than half the range: ({halfRange})",
"stepError1": "Step must be at least 1/200 of the range: ({rangePortion})",
"stepError1": "Step must be at least 1/200 of the range: ({rangePortion}). Questions that have more than 200 possible outcomes should be continuous",
"minMaxError0": "Provide correct min and max values",
"minMaxError1": "Minimum value should be less than maximum value",
"rangeWarning0": "Warning: Step does not divide the range evenly. Max reduced to {newMax}",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@
"zeroPointError0": "El punto cero no está permitido para preguntas discretas",
"zeroPointError1": "El punto cero ({zeroPoint}) no debe estar entre min ({min}) y max ({max})",
"stepError0": "El paso no puede ser mayor que la mitad del rango: ({halfRange})",
"stepError1": "El paso debe ser al menos 1/200 del rango: ({rangePortion})",
"stepError1": "El paso debe ser al menos 1/200 del rango: ({rangePortion}). Las preguntas que tienen más de 200 resultados posibles deben ser continuas",
"minMaxError0": "Proporcione valores correctos de mínimo y máximo",
"minMaxError1": "El valor mínimo debe ser menor que el valor máximo",
"rangeWarning0": "Advertencia: El paso no divide el rango de manera uniforme. Max reducido a {newMax}",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@
"zeroPointError0": "Ponto zero não é suportado para perguntas discretas",
"zeroPointError1": "O ponto zero ({zeroPoint}) não deve estar entre o mínimo ({min}) e o máximo ({max})",
"stepError0": "O passo não pode ser maior que a metade do intervalo: ({halfRange})",
"stepError1": "O passo deve ser pelo menos 1/200 do intervalo: ({rangePortion})",
"stepError1": "O passo deve ser pelo menos 1/200 do intervalo: ({rangePortion}). Perguntas com mais de 200 resultados possíveis devem ser contínuas",
"minMaxError0": "Forneça valores mínimos e máximos corretos",
"minMaxError1": "O valor mínimo deve ser menor que o valor máximo",
"rangeWarning0": "Aviso: O passo não divide o intervalo de forma uniforme. Máximo reduzido para {newMax}",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@
"zeroPointError0": "不支持離散問題的零點",
"zeroPointError1": "零點 ({zeroPoint}) 不應位於最小值 ({min}) 和最大值 ({max}) 之間",
"stepError0": "步驟不能超過範圍的一半: ({halfRange})",
"stepError1": "步驟至少必須是範圍的1/200: ({rangePortion})",
"stepError1": "步驟至少必須是範圍的1/200: ({rangePortion})。超過200個可能結果的問題應使用連續類型",
"minMaxError0": "提供正確的最小值和最大值",
"minMaxError1": "最小值應小於最大值",
"rangeWarning0": "警告:步驟無法均等地劃分範圍。最大值減至 {newMax}",
Expand Down
2 changes: 1 addition & 1 deletion front_end/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@
"zeroPointError0": "不支持离散问题的零点",
"zeroPointError1": "零点 ({zeroPoint}) 不应在最小值 ({min}) 和最大值 ({max}) 之间",
"stepError0": "步长不能超过范围的一半: ({halfRange})",
"stepError1": "步长必须至少是范围的1/200: ({rangePortion})",
"stepError1": "步长必须至少是范围的1/200: ({rangePortion})。超过200个可能结果的问题应使用连续类型",
"minMaxError0": "请提供正确的最小值和最大值",
"minMaxError1": "最小值应小于最大值",
"rangeWarning0": "警告: 步长不能平均划分范围。最大值减少到 {newMax}",
Expand Down
7 changes: 7 additions & 0 deletions front_end/src/app/(main)/question-writing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ export default function QuestionChecklist() {
enough that the true value is very unlikely to fall outside, but no
wider.
</li>
<li>
<strong>
Discrete questions should have at most 200 possible outcomes.
</strong>{" "}
Questions that have more than 200 possible outcomes should use the
continuous question type instead.
</li>
<li>
<strong>Double check.</strong> Proof-read your submission,
double-check your resolution conditions and ranges, and make sure
Expand Down
11 changes: 11 additions & 0 deletions questions/serializers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ def validate(self, data: dict):
errors.append("Range Max is required for continuous questions")
if data.get("range_min") is None:
errors.append("Range Min is required for continuous questions")
if question_type == Question.QuestionType.DISCRETE:
inbound_outcome_count = data.get("inbound_outcome_count")
if (
inbound_outcome_count is not None
and inbound_outcome_count > DEFAULT_INBOUND_OUTCOME_COUNT
):
errors.append(
f"Discrete questions cannot have more than "
f"{DEFAULT_INBOUND_OUTCOME_COUNT} outcomes. "
f"Consider using a continuous question type instead."
)

if errors:
raise serializers.ValidationError(errors)
Expand Down