Skip to content

Commit

Permalink
Replaced num_submissions === 0 checks with checks for has_handgradeab…
Browse files Browse the repository at this point in the history
…le_submission. Updated tests.
  • Loading branch information
James Perretta committed Aug 5, 2024
1 parent e7827d9 commit 472a927
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 56 deletions.
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-valid-submission': status === HandgradingStatus.no_valid_submission,
'no-handgradeable-submission': status === HandgradingStatus.no_submission,
}"
v-on="$listeners">
<div class="member-names">
Expand Down Expand Up @@ -78,9 +78,8 @@ export default class GroupSummaryPanel extends Vue {
color: $ocean-blue;
}
.no-valid-submission {
.no-handgradeable-submission {
color: $stormy-gray-dark;
pointer-events: none; // Make the panel unclickable
}
</style>
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-valid-submission"
id="no-handgradeable-submission"
class="radio"
v-model="d_status_filter"
:value="HandgradingStatus.no_valid_submission">
<label class="label"
for="no-valid-submission">{{HandgradingStatus.no_valid_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_valid_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
4 changes: 2 additions & 2 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_valid_submission = "No Valid Submissions",
no_handgradeable_submission = "No Submission",
ungraded = "Ungraded",
in_progress = "In Progress",
graded = "Graded",
}

export function get_handgrading_status(group_summary: GroupWithHandgradingResultSummary) {
if (!group_summary.has_handgradeable_submission) {
return HandgradingStatus.no_valid_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,13 +54,13 @@ 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}, true,
);
await set_props(wrapper, {group_summary: no_submission_summary});
expect(wrapper.find('.status').text()).toEqual('No Submission');
Expand Down
Loading

0 comments on commit 472a927

Please sign in to comment.