Pass `user_points` and `max_points` to edoniq test result cypress_reset
This commit is contained in:
parent
d92b514759
commit
2b50c1d90f
|
|
@ -46,9 +46,9 @@ describe("competenceCertificate.cy.js", () => {
|
||||||
).should("contain", "Höchstpunktzahl");
|
).should("contain", "Höchstpunktzahl");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("check with finished edoniq test", () => {
|
it("check with finished passed edoniq test", () => {
|
||||||
cy.manageCommand(
|
cy.manageCommand(
|
||||||
"cypress_reset --create-assignment-completion --create-edoniq-test-results"
|
"cypress_reset --create-assignment-completion --create-edoniq-test-results 19 24"
|
||||||
);
|
);
|
||||||
login("test-student1@example.com", "test");
|
login("test-student1@example.com", "test");
|
||||||
cy.visit("/course/test-lehrgang/competence");
|
cy.visit("/course/test-lehrgang/competence");
|
||||||
|
|
@ -95,7 +95,7 @@ describe("competenceCertificate.cy.js", () => {
|
||||||
|
|
||||||
it("check with finished edoniq test and finished casework", () => {
|
it("check with finished edoniq test and finished casework", () => {
|
||||||
cy.manageCommand(
|
cy.manageCommand(
|
||||||
"cypress_reset --create-assignment-evaluation --create-edoniq-test-results"
|
"cypress_reset --create-assignment-evaluation --create-edoniq-test-results 19 24"
|
||||||
);
|
);
|
||||||
login("test-student1@example.com", "test");
|
login("test-student1@example.com", "test");
|
||||||
cy.visit("/course/test-lehrgang/competence");
|
cy.visit("/course/test-lehrgang/competence");
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,11 @@ from vbv_lernwelt.notify.models import Notification
|
||||||
help="will create assignment evaluation data for test-student1@example.com",
|
help="will create assignment evaluation data for test-student1@example.com",
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--create-edoniq-test-results/--no-create-edoniq-test-results",
|
"--create-edoniq-test-results",
|
||||||
default=False,
|
type=(int, int),
|
||||||
help="will create edoniq result data for test-student1@example.com",
|
default=(None, None),
|
||||||
|
metavar="USER_POINTS MAX_POINTS",
|
||||||
|
help="Create edoniq result data for test-student1@example.com with user points and max points",
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--create-feedback-responses/--no-create-feedback-responses",
|
"--create-feedback-responses/--no-create-feedback-responses",
|
||||||
|
|
@ -76,15 +78,19 @@ def command(
|
||||||
evaluation_user=User.objects.get(id=TEST_TRAINER1_USER_ID),
|
evaluation_user=User.objects.get(id=TEST_TRAINER1_USER_ID),
|
||||||
)
|
)
|
||||||
|
|
||||||
if create_edoniq_test_results:
|
user_points, max_points = create_edoniq_test_results
|
||||||
print("create edoniq test results")
|
if user_points is not None and max_points is not None:
|
||||||
|
print(
|
||||||
|
f"Create edoniq test results: User Points: {user_points}, Max Points: {max_points}"
|
||||||
|
)
|
||||||
create_edoniq_test_result_data(
|
create_edoniq_test_result_data(
|
||||||
assignment=Assignment.objects.get(
|
assignment=Assignment.objects.get(
|
||||||
slug="test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo"
|
slug="test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo"
|
||||||
),
|
),
|
||||||
course_session=CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID),
|
course_session=CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID),
|
||||||
assignment_user=User.objects.get(id=TEST_STUDENT1_USER_ID),
|
assignment_user=User.objects.get(id=TEST_STUDENT1_USER_ID),
|
||||||
points=19,
|
user_points=user_points,
|
||||||
|
max_points=max_points,
|
||||||
)
|
)
|
||||||
|
|
||||||
if create_feedback_responses:
|
if create_feedback_responses:
|
||||||
|
|
|
||||||
|
|
@ -141,23 +141,30 @@ def cypress_reset_view(request):
|
||||||
create_assignment_evaluation = (
|
create_assignment_evaluation = (
|
||||||
request.data.get("create_assignment_evaluation") == "true"
|
request.data.get("create_assignment_evaluation") == "true"
|
||||||
)
|
)
|
||||||
create_edoniq_test_results = (
|
create_feedback_responses = (
|
||||||
request.data.get("create_edoniq_test_results") == "true"
|
request.data.get("create_feedback_responses") == "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: Handle the flags as needed. For example:
|
# edoniq test results
|
||||||
|
edoniq_test_user_points = request.data.get("edoniq_test_user_points")
|
||||||
|
edoniq_test_max_points = request.data.get("edoniq_test_max_points")
|
||||||
|
|
||||||
|
options = {}
|
||||||
if create_assignment_completion:
|
if create_assignment_completion:
|
||||||
# Logic for creating assignment completion
|
options["create_assignment_completion"] = create_assignment_completion
|
||||||
pass
|
if create_assignment_evaluation:
|
||||||
if create_edoniq_test_results:
|
options["create_assignment_evaluation"] = create_assignment_evaluation
|
||||||
# Logic for creating Edoniq test results
|
if create_feedback_responses:
|
||||||
pass
|
options["create_feedback_responses"] = create_feedback_responses
|
||||||
|
if bool(edoniq_test_user_points and edoniq_test_max_points):
|
||||||
|
options["create_edoniq_test_results"] = (
|
||||||
|
int(edoniq_test_user_points),
|
||||||
|
int(edoniq_test_max_points),
|
||||||
|
)
|
||||||
|
|
||||||
call_command(
|
call_command(
|
||||||
"cypress_reset",
|
"cypress_reset",
|
||||||
create_assignment_completion=create_assignment_completion,
|
**options,
|
||||||
create_assignment_evaluation=create_assignment_evaluation,
|
|
||||||
create_edoniq_test_results=create_edoniq_test_results,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return HttpResponseRedirect("/server/admin/")
|
return HttpResponseRedirect("/server/admin/")
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ def create_test_assignment_evaluation_data(
|
||||||
|
|
||||||
|
|
||||||
def create_edoniq_test_result_data(
|
def create_edoniq_test_result_data(
|
||||||
assignment, course_session, assignment_user, points=24
|
assignment, course_session, assignment_user, user_points=19, max_points=24
|
||||||
):
|
):
|
||||||
if assignment and course_session and assignment_user:
|
if assignment and course_session and assignment_user:
|
||||||
update_assignment_completion(
|
update_assignment_completion(
|
||||||
|
|
@ -302,7 +302,8 @@ def create_edoniq_test_result_data(
|
||||||
completion_data={},
|
completion_data={},
|
||||||
completion_status=AssignmentCompletionStatus.EVALUATION_SUBMITTED,
|
completion_status=AssignmentCompletionStatus.EVALUATION_SUBMITTED,
|
||||||
evaluation_user=User.objects.get(username="admin"),
|
evaluation_user=User.objects.get(username="admin"),
|
||||||
evaluation_points=points,
|
evaluation_points=user_points,
|
||||||
|
evaluation_max_points=max_points,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,18 +51,30 @@
|
||||||
<input type="checkbox" name="create_assignment_completion" value="true">
|
<input type="checkbox" name="create_assignment_completion" value="true">
|
||||||
create_assignment_completion
|
create_assignment_completion
|
||||||
</label>
|
</label>
|
||||||
<div style="margin: 8px"></div>
|
<div style="margin-bottom: 8px; padding: 4px; border-bottom: 1px lightblue solid"></div>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="create_assignment_evaluation" value="true">
|
<input type="checkbox" name="create_assignment_evaluation" value="true">
|
||||||
create_assignment_evaluation
|
create_assignment_evaluation
|
||||||
</label>
|
</label>
|
||||||
<div style="margin: 8px"></div>
|
<div style="margin-bottom: 8px; padding: 4px; border-bottom: 1px lightblue solid"></div>
|
||||||
|
|
||||||
|
<label>create_edoniq_test_result_data</label><br>
|
||||||
|
<label>
|
||||||
|
user points:
|
||||||
|
<input type="number" name="edoniq_test_user_points" min="0">
|
||||||
|
</label><br>
|
||||||
|
<label>
|
||||||
|
max points:
|
||||||
|
<input type="number" name="edoniq_test_max_points" min="0">
|
||||||
|
</label>
|
||||||
|
<div style="margin-bottom: 8px; padding: 4px; border-bottom: 1px lightblue solid"></div>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="create_edoniq_test_results" value="true">
|
<input type="checkbox" name="create_feedback_responses" value="true">
|
||||||
create_edoniq_test_results
|
create_feedback_responses
|
||||||
</label>
|
</label>
|
||||||
<div style="margin: 8px"></div>
|
<div style="margin-bottom: 8px; padding: 4px; border-bottom: 1px lightblue solid"></div>
|
||||||
|
|
||||||
<button class="btn">Testdaten zurück setzen</button>
|
<button class="btn">Testdaten zurück setzen</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue