Skip to content

Commit

Permalink
Merge pull request #4039 from Pursottam6003/fixorder
Browse files Browse the repository at this point in the history
Fix #2797  incorrect order of options in the Exercise > Edit Details page > Assessment options
  • Loading branch information
rtibbles authored May 4, 2023
2 parents b27645f + aac5c50 commit d82d165
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
const MasteryModels = new Set([
'do_all',
'm_of_n',
'num_correct_in_a_row_10',
'num_correct_in_a_row_2',
'num_correct_in_a_row_3',
'num_correct_in_a_row_5',
'num_correct_in_a_row_10',
]);

export default MasteryModels;
Expand All @@ -15,8 +15,8 @@ export const MasteryModelsList = Array.from(MasteryModels);
export const MasteryModelsNames = {
DO_ALL: 'do_all',
M_OF_N: 'm_of_n',
NUM_CORRECT_IN_A_ROW_10: 'num_correct_in_a_row_10',
NUM_CORRECT_IN_A_ROW_2: 'num_correct_in_a_row_2',
NUM_CORRECT_IN_A_ROW_3: 'num_correct_in_a_row_3',
NUM_CORRECT_IN_A_ROW_5: 'num_correct_in_a_row_5',
NUM_CORRECT_IN_A_ROW_10: 'num_correct_in_a_row_10',
};
6 changes: 4 additions & 2 deletions deploy/generatejsconstantfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def generate_constants_set_file(
# Don't generate this unless ids are strings
generate_names_constants = True
for constant in sorted(
constant_list, key=lambda x: x if mapper is None else getattr(x, sort_by)
constant_list, key=lambda x: 0 if mapper is None else getattr(x, sort_by)
):
output += " "
value = mapper(constant) if mapper is not None else constant
Expand Down Expand Up @@ -177,7 +177,9 @@ def main():
)

generate_constants_set_file(
[m[0] for m in exercises.MASTERY_MODELS if m[0] != exercises.SKILL_CHECK],
[m[0] for m in sorted(
exercises.MASTERY_MODELS, key=lambda x: int(x[0][21:]) if 'num_correct_in_a_row_' in x[0] else 0
) if m[0] != exercises.SKILL_CHECK and m[0] != exercises.QUIZ],
"MasteryModels",
)
generate_constants_set_file([r[0] for r in roles.choices], "Roles")
Expand Down

0 comments on commit d82d165

Please sign in to comment.