Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 94e0400
Merge: be2feea 87a4fad
Author: Colin McFadden <[email protected]>
Date:   Wed Jan 5 13:44:52 2022 -0600

    Merge branch 'hotfix/fix-multiple-response-checkboxes' of https://github.com/UMN-LATIS/ChimeIn2.0 into hotfix/fix-multiple-response-checkboxes

commit be2feea
Author: Colin McFadden <[email protected]>
Date:   Wed Jan 5 13:34:10 2022 -0600

    fix student viewing of chime results

commit 87a4fad
Author: James Johnson <[email protected]>
Date:   Wed Jan 5 13:17:15 2022 -0600

    default to this.selected rather than null

commit 4bfffe9
Author: James Johnson <[email protected]>
Date:   Wed Jan 5 12:02:38 2022 -0600

    Add test for multiple responses

commit 85b703f
Author: Colin McFadden <[email protected]>
Date:   Wed Jan 5 10:38:20 2022 -0600

    ugh vscode is driving me bananas

commit d7f9496
Author: Colin McFadden <[email protected]>
Date:   Wed Jan 5 10:35:50 2022 -0600

    can't check that [] != [] since they're references. Instead just don't set the default value if we don't have something

commit 05e940a
Author: Colin McFadden <[email protected]>
Date:   Wed Jan 5 10:27:01 2022 -0600

    woops

commit 7428bf9
Author: Colin McFadden <[email protected]>
Date:   Wed Jan 5 10:22:21 2022 -0600

    fix value

commit 65ea56f
Author: Colin McFadden <[email protected]>
Date:   Wed Jan 5 10:13:26 2022 -0600

    fix for default value in checkboxes
  • Loading branch information
jxjj committed Jan 5, 2022
1 parent e7367c5 commit 146145b
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/ChimeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getChime(Request $req) {

$chime->load("folders");

if ($chime != null && $chime->pivot->permission_number >= 300) {
if ($chime != null && ($chime->pivot->permission_number >= 300 || $chime->students_can_view)) {
return response()->json($chime);
} else {
return response()->json(["status"=>"error", "message"=>"You don't have permission to access this Chime"], 403);
Expand Down
64 changes: 63 additions & 1 deletion cypress/integration/ui/question.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,69 @@ describe("question", () => {
});

it("changes the folder");
it("allows multiple reponses");
it("allows multiple responses", () => {
let testChime;
let testFolder;
api
.createChime({ name: "Test Chime" })
.then((chime) => {
testChime = chime;
return api.createFolder({ name: "Test Folder", chimeId: chime.id });
})
.then((folder) => {
testFolder = folder;
})
.then(() => {
cy.visit(`/chime/${testChime.id}/folder/${testFolder.id}`);

// create a multiple response question
cy.get("[data-cy=new-question-button]").click();
cy.get("[data-cy=question-type]").type("Multiple Choice{enter}");
cy.get('[data-cy="allow-multiple-responses-checkbox"]').click();

cy.get("[data-cy=question-editor]").type("Which numbers are prime?");
cy.get("[data-cy=add-choice-button]")
.click()
.type("1{enter}")
.type("2{enter}")
.type("3{enter}")
.type("4{enter}");

// mark 2 and 3 as correct
cy.get(":nth-child(2) > .response-choice-item__correct-toggle").click();
cy.get(":nth-child(3) > .response-choice-item__correct-toggle").click();

cy.contains("Save").click();
cy.wait("@apiCreateQuestion");
})
.then(() => {
// open the question
cy.get("[data-cy=toggle-open-question]").click();
cy.logout();
})
.then(() => {
// join as participant
cy.visit(`/join/${testChime.access_code}`);

// check options
cy.get("#radio1_1").click();
cy.wait("@apiSubmitResponse");
cy.get("#radio1_2").click();
})
.then(() => {
// check that results render properly
cy.login("faculty");
cy.visit(`/chime/${testChime.id}/folder/${testFolder.id}`);
cy.get("[data-cy=present-question-button]").click();
cy.get("[data-cy=show-results-button]").click();

// wait for rendering
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000);
cy.get("#app").matchImageSnapshot("multiple-response");
});
});

it("supports rich text formatting in the question text");
it("allows LaTeX in the question text");
it("creates an anonymous question");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
},
},
mounted() {
this.selected = get(this, "response.response_info.choice", null);
this.selected = get(this, "response.response_info.choice", this.selected);
},
};
</script>
1 change: 1 addition & 0 deletions resources/assets/js/views/QuestionForm/QuestionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
v-model="allow_multiple"
type="checkbox"
class="form-check-input"
data-cy="allow-multiple-responses-checkbox"
/>
Allow Multiple Responses
</label>
Expand Down

0 comments on commit 146145b

Please sign in to comment.