Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in handgrading when selecting group with only non-gradable submissions #518

Merged
merged 9 commits into from
Aug 5, 2024
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@types/minimatch": "^3.0.5",
"ag-client-typescript": "2.5.0",
"ag-client-typescript": "2.6.0",
"chart.js": "^3.9.1",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-zoom": "^1.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'graded': status === HandgradingStatus.graded,
'ungraded': status === HandgradingStatus.ungraded,
'in-progress': status === HandgradingStatus.in_progress,
'no-submission': status === HandgradingStatus.no_submission,
'no-handgradeable-submission': status === HandgradingStatus.no_submission,
}"
v-on="$listeners">
<div class="member-names">
Expand Down Expand Up @@ -78,7 +78,7 @@ export default class GroupSummaryPanel extends Vue {
color: $ocean-blue;
}

.no-submission {
.no-handgradeable-submission {
color: $stormy-gray-dark;
}

Expand Down
20 changes: 11 additions & 9 deletions src/components/project_view/handgrading/handgrading_container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@
</div>
<div class="radio-container">
<input type="radio" name="status"
id="no-submission"
id="no-handgradeable-submission"
class="radio"
v-model="d_status_filter"
:value="HandgradingStatus.no_submission">
<label class="label"
for="no-submission">{{HandgradingStatus.no_submission}}</label>
:value="HandgradingStatus.no_handgradeable_submission">
<label
class="label"
for="no-handgradeable-submission"
>{{HandgradingStatus.no_handgradeable_submission}}</label>
</div>
</div>
</div>
Expand All @@ -90,7 +92,7 @@
:class="{
'active': d_currently_grading !== null
&& d_currently_grading.group === group_summary.pk,
'disabled': group_summary.num_submissions === 0
'disabled': !group_summary.has_handgradeable_submission
}">
</group-summary-panel>
</template>
Expand Down Expand Up @@ -234,13 +236,13 @@ export default class HandgradingContainer extends Vue implements ag_cli.Handgrad

get total_num_to_grade() {
return this.staff_filtered_groups.filter(
group => get_handgrading_status(group) !== HandgradingStatus.no_submission
group => get_handgrading_status(group) !== HandgradingStatus.no_handgradeable_submission
).length;
}

@handle_global_errors_async
async select_for_grading(group: ag_cli.GroupWithHandgradingResultSummary) {
if (group.num_submissions !== 0) {
if (group.has_handgradeable_submission) {
await toggle(this, 'd_loading_result', async () => {
this.d_currently_grading = await ag_cli.HandgradingResult.get_or_create(group.pk);
});
Expand All @@ -250,7 +252,7 @@ export default class HandgradingContainer extends Vue implements ag_cli.Handgrad
get previous() {
let index = this.index_of_currently_grading - 1;
while (index >= 0) {
if (this.staff_filtered_groups[index].num_submissions !== 0) {
if (this.staff_filtered_groups[index].has_handgradeable_submission) {
return this.staff_filtered_groups[index];
}
index -= 1;
Expand All @@ -261,7 +263,7 @@ export default class HandgradingContainer extends Vue implements ag_cli.Handgrad
get next() {
let index = this.index_of_currently_grading + 1;
while (index < this.staff_filtered_groups.length) {
if (this.staff_filtered_groups[index].num_submissions !== 0) {
if (this.staff_filtered_groups[index].has_handgradeable_submission) {
return this.staff_filtered_groups[index];
}
index += 1;
Expand Down
6 changes: 3 additions & 3 deletions src/components/project_view/handgrading/handgrading_status.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { GroupWithHandgradingResultSummary } from 'ag-client-typescript';

export enum HandgradingStatus {
no_submission = "No Submission",
no_handgradeable_submission = "No Submission",
ungraded = "Ungraded",
in_progress = "In Progress",
graded = "Graded",
}

export function get_handgrading_status(group_summary: GroupWithHandgradingResultSummary) {
if (group_summary.num_submissions === 0) {
return HandgradingStatus.no_submission;
if (!group_summary.has_handgradeable_submission) {
return HandgradingStatus.no_handgradeable_submission;
}

let result = group_summary.handgrading_result;
Expand Down
4 changes: 3 additions & 1 deletion tests/data_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,17 @@ export function make_group_summary(
project_pk: number,
num_members: number = 1,
group_args: Partial<Group> = {},
has_handgradeable_submission: boolean = false,
handgrading_result: {
finished_grading: boolean;
total_points: number;
total_points_possible: number;
} | null = null
} | null = null,
): GroupWithHandgradingResultSummary {
let group = make_group(project_pk, num_members, group_args);
return {
handgrading_result: handgrading_result,
has_handgradeable_submission: has_handgradeable_submission,
...group
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test('Group member names displayed', () => {

test('Score displayed when status is graded', () => {
let summary = data_ut.make_group_summary(
project.pk, 1, {num_submissions: 1},
project.pk, 1, {num_submissions: 1}, true,
{finished_grading: true, total_points: 4, total_points_possible: 5}
);
let wrapper = managed_mount(GroupSummaryPanel, {
Expand All @@ -43,7 +43,7 @@ test('Score displayed when status is graded', () => {

test('Non-graded statuses show status text', async () => {
let in_progress_summary = data_ut.make_group_summary(
project.pk, 1, {num_submissions: 1},
project.pk, 1, {num_submissions: 1}, true,
{finished_grading: false, total_points: 3, total_points_possible: 5}
);
let wrapper = managed_mount(GroupSummaryPanel, {
Expand All @@ -54,14 +54,20 @@ test('Non-graded statuses show status text', async () => {
expect(wrapper.find('.status').text()).toEqual('In Progress');

let ungraded_summary = data_ut.make_group_summary(
project.pk, 1, {num_submissions: 1},
project.pk, 1, {num_submissions: 1}, true,
);
await set_props(wrapper, {group_summary: ungraded_summary});
expect(wrapper.find('.status').text()).toEqual('Ungraded');

let no_submission_summary = data_ut.make_group_summary(
project.pk, 1, {num_submissions: 0},
project.pk, 1, {num_submissions: 0}, false,
);
await set_props(wrapper, {group_summary: no_submission_summary});
expect(wrapper.find('.status').text()).toEqual('No Submission');

let no_handgradeable_submission_summary = data_ut.make_group_summary(
project.pk, 1, {num_submissions: 1}, false,
);
await set_props(wrapper, {group_summary: no_handgradeable_submission_summary});
expect(wrapper.find('.status').text()).toEqual('No Submission');
});
Loading
Loading