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");
|
||||
});
|
||||
|
||||
it("check with finished edoniq test", () => {
|
||||
it("check with finished passed edoniq test", () => {
|
||||
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");
|
||||
cy.visit("/course/test-lehrgang/competence");
|
||||
|
|
@ -95,7 +95,7 @@ describe("competenceCertificate.cy.js", () => {
|
|||
|
||||
it("check with finished edoniq test and finished casework", () => {
|
||||
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");
|
||||
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",
|
||||
)
|
||||
@click.option(
|
||||
"--create-edoniq-test-results/--no-create-edoniq-test-results",
|
||||
default=False,
|
||||
help="will create edoniq result data for test-student1@example.com",
|
||||
"--create-edoniq-test-results",
|
||||
type=(int, int),
|
||||
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(
|
||||
"--create-feedback-responses/--no-create-feedback-responses",
|
||||
|
|
@ -76,15 +78,19 @@ def command(
|
|||
evaluation_user=User.objects.get(id=TEST_TRAINER1_USER_ID),
|
||||
)
|
||||
|
||||
if create_edoniq_test_results:
|
||||
print("create edoniq test results")
|
||||
user_points, max_points = 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(
|
||||
assignment=Assignment.objects.get(
|
||||
slug="test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo"
|
||||
),
|
||||
course_session=CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_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:
|
||||
|
|
|
|||
|
|
@ -141,23 +141,30 @@ def cypress_reset_view(request):
|
|||
create_assignment_evaluation = (
|
||||
request.data.get("create_assignment_evaluation") == "true"
|
||||
)
|
||||
create_edoniq_test_results = (
|
||||
request.data.get("create_edoniq_test_results") == "true"
|
||||
create_feedback_responses = (
|
||||
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:
|
||||
# Logic for creating assignment completion
|
||||
pass
|
||||
if create_edoniq_test_results:
|
||||
# Logic for creating Edoniq test results
|
||||
pass
|
||||
options["create_assignment_completion"] = create_assignment_completion
|
||||
if create_assignment_evaluation:
|
||||
options["create_assignment_evaluation"] = create_assignment_evaluation
|
||||
if create_feedback_responses:
|
||||
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(
|
||||
"cypress_reset",
|
||||
create_assignment_completion=create_assignment_completion,
|
||||
create_assignment_evaluation=create_assignment_evaluation,
|
||||
create_edoniq_test_results=create_edoniq_test_results,
|
||||
**options,
|
||||
)
|
||||
|
||||
return HttpResponseRedirect("/server/admin/")
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ def create_test_assignment_evaluation_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:
|
||||
update_assignment_completion(
|
||||
|
|
@ -302,7 +302,8 @@ def create_edoniq_test_result_data(
|
|||
completion_data={},
|
||||
completion_status=AssignmentCompletionStatus.EVALUATION_SUBMITTED,
|
||||
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">
|
||||
create_assignment_completion
|
||||
</label>
|
||||
<div style="margin: 8px"></div>
|
||||
<div style="margin-bottom: 8px; padding: 4px; border-bottom: 1px lightblue solid"></div>
|
||||
<label>
|
||||
<input type="checkbox" name="create_assignment_evaluation" value="true">
|
||||
create_assignment_evaluation
|
||||
</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>
|
||||
<input type="checkbox" name="create_edoniq_test_results" value="true">
|
||||
create_edoniq_test_results
|
||||
<input type="checkbox" name="create_feedback_responses" value="true">
|
||||
create_feedback_responses
|
||||
</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>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue