Can now generate lots of mc in level custom.
This commit is contained in:
53
app.py
53
app.py
@@ -361,9 +361,11 @@ def get_writing_task_1_general_question():
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
def add_newline_before_hyphen(s):
|
||||
return s.replace(" -", "\n-")
|
||||
|
||||
|
||||
@app.route('/writing_task2', methods=['POST'])
|
||||
@jwt_required()
|
||||
def grade_writing_task_2():
|
||||
@@ -501,7 +503,7 @@ def get_writing_task_2_general_question():
|
||||
"content": (
|
||||
'Craft a comprehensive question of ' + difficulty + 'difficulty like the ones for IELTS Writing Task 2 General Training that directs the candidate '
|
||||
'to delve into an in-depth analysis of contrasting perspectives on the topic of "' + topic + '". '
|
||||
'The candidate should be asked to discuss the strengths and weaknesses of both viewpoints.')
|
||||
'The candidate should be asked to discuss the strengths and weaknesses of both viewpoints.')
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
@@ -1535,18 +1537,53 @@ def get_custom_level():
|
||||
exercise_mc_qty = int(request.args.get('exercise_' + str(i) + '_mc_qty', -1))
|
||||
|
||||
if exercise_type == CustomLevelExerciseTypes.MULTIPLE_CHOICE_4.value:
|
||||
response["exercises"]["exercise_" + str(i)] = generate_level_mc(exercise_id, exercise_qty)
|
||||
response["exercises"]["exercise_" + str(i)] = {}
|
||||
response["exercises"]["exercise_" + str(i)]["questions"] = []
|
||||
response["exercises"]["exercise_" + str(i)]["type"] = "multipleChoice"
|
||||
exercise_id = exercise_id + exercise_qty
|
||||
while exercise_qty > 0:
|
||||
if exercise_qty - 15 > 0:
|
||||
qty = 15
|
||||
else:
|
||||
qty = exercise_qty
|
||||
|
||||
response["exercises"]["exercise_" + str(i)]["questions"].extend(
|
||||
generate_level_mc(exercise_id, qty,
|
||||
response["exercises"]["exercise_" + str(i)]["questions"])["questions"])
|
||||
exercise_id = exercise_id + qty
|
||||
exercise_qty = exercise_qty - qty
|
||||
|
||||
elif exercise_type == CustomLevelExerciseTypes.MULTIPLE_CHOICE_BLANK_SPACE.value:
|
||||
response["exercises"]["exercise_" + str(i)] = gen_multiple_choice_blank_space_utas(exercise_qty,
|
||||
exercise_id)
|
||||
response["exercises"]["exercise_" + str(i)] = {}
|
||||
response["exercises"]["exercise_" + str(i)]["questions"] = []
|
||||
response["exercises"]["exercise_" + str(i)]["type"] = "multipleChoice"
|
||||
exercise_id = exercise_id + exercise_qty
|
||||
while exercise_qty > 0:
|
||||
if exercise_qty - 15 > 0:
|
||||
qty = 15
|
||||
else:
|
||||
qty = exercise_qty
|
||||
|
||||
response["exercises"]["exercise_" + str(i)]["questions"].extend(
|
||||
gen_multiple_choice_blank_space_utas(qty, exercise_id,
|
||||
response["exercises"]["exercise_" + str(i)]["questions"])["questions"])
|
||||
exercise_id = exercise_id + exercise_qty
|
||||
exercise_qty = exercise_qty - qty
|
||||
|
||||
elif exercise_type == CustomLevelExerciseTypes.MULTIPLE_CHOICE_UNDERLINED.value:
|
||||
response["exercises"]["exercise_" + str(i)] = gen_multiple_choice_underlined_utas(exercise_qty, exercise_id)
|
||||
response["exercises"]["exercise_" + str(i)] = {}
|
||||
response["exercises"]["exercise_" + str(i)]["questions"] = []
|
||||
response["exercises"]["exercise_" + str(i)]["type"] = "multipleChoice"
|
||||
exercise_id = exercise_id + exercise_qty
|
||||
while exercise_qty > 0:
|
||||
if exercise_qty - 15 > 0:
|
||||
qty = 15
|
||||
else:
|
||||
qty = exercise_qty
|
||||
|
||||
response["exercises"]["exercise_" + str(i)]["questions"].extend(
|
||||
gen_multiple_choice_underlined_utas(qty, exercise_id,
|
||||
response["exercises"]["exercise_" + str(i)]["questions"])["questions"])
|
||||
exercise_id = exercise_id + exercise_qty
|
||||
exercise_qty = exercise_qty - qty
|
||||
|
||||
elif exercise_type == CustomLevelExerciseTypes.BLANK_SPACE_TEXT.value:
|
||||
response["exercises"]["exercise_" + str(i)] = gen_blank_space_text_utas(exercise_qty, exercise_id,
|
||||
exercise_text_size)
|
||||
|
||||
Reference in New Issue
Block a user