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

Check and apply max deduction for handgrading annotations #512

Closed
wants to merge 7 commits into from

Conversation

broad-well
Copy link
Contributor

This PR fixes #502. When an annotation is applied or deleted in the Handgrading interface, we compute the effective change to the score based on its max deduction and total number of applications so far.

Tests are included for both applying and deleting annotations across the max deduction boundary. Additional tests are included for cases where the max deduction of an annotation is not a multiple of its unit deduction, such as ("-3/-7 max"). This PR's implementation changes makes those tests pass.

Screenshots

After

Screenshot 2024-04-20 at 12-34-51 Autograder io

);
ag_cli.AppliedAnnotation.notify_applied_annotation_created(applied_annotation);
}
wrapper.vm.$forceUpdate();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to avoid $forceUpdate to make sure that the page is re-rendered appropriately. Does it work with expect(await wait_until(wrapper, w => !w.vm.saving)).toBe(true); instead?

Copy link
Contributor

@Normanwqn Normanwqn Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will test with that. Is there a reason that $forceUpdate is used here?

 test('Handgraders allowed to leave custom comments', async () => {
        wrapper.vm.d_handgrading_result!.handgrading_rubric.handgraders_can_leave_comments = true;
        data_ut.set_global_user_roles(data_ut.make_user_roles({is_handgrader: true}));
        wrapper.vm.$forceUpdate();
        await wrapper.vm.$nextTick();
        expect(wrapper.find('#new-comment').exists()).toBe(true);

        expect(wrapper.findAll('.comment').at(0).find('.delete').exists()).toBe(true);
        expect(wrapper.findAll('.comment').at(3).find('.delete').exists()).toBe(true);
        // Can always delete applied annotations
        expect(wrapper.findAll('.comment').at(1).find('.delete').exists()).toBe(true);
        expect(wrapper.findAll('.comment').at(2).find('.delete').exists()).toBe(true);
    });

Replaced forceUpdate with expect(await wait_until(wrapper, w => !w.vm.saving)).toBe(true);
previously written test case Handgraders allowed to leave custom
comments
@Normanwqn
Copy link
Contributor

@james-perretta
We changed $forceUpdate to expect(await wait_until(wrapper, w => !w.vm.saving)).toBe(true);, and all unit tests are still passed

We also changed a previously written test case Handgraders allowed to leave custom comments which uses $forceUpdate, to use expect(await wait_until(wrapper, w => !w.vm.saving)).toBe(true);` instead.

james-perretta
james-perretta previously approved these changes Apr 24, 2024
@broad-well broad-well dismissed james-perretta’s stale review April 24, 2024 13:33

The merge-base changed after approval.

james-perretta
james-perretta previously approved these changes Apr 24, 2024
@james-perretta
Copy link
Contributor

@broad-well Did github do that automatically (dismissing the stale review)? For some reason the "merge automatically" check isn't going through on my end, and it still says review required after I approved the PR. I'll check back later to see if it resolves itself, otherwise I'll have you try re-opening the PR.

@broad-well broad-well dismissed james-perretta’s stale review April 24, 2024 13:44

The merge-base changed after approval.

@broad-well
Copy link
Contributor Author

@broad-well Did github do that automatically (dismissing the stale review)? For some reason the "merge automatically" check isn't going through on my end, and it still says review required after I approved the PR. I'll check back later to see if it resolves itself, otherwise I'll have you try re-opening the PR.

Yes, GitHub automatically dismissed your review. It does this because (1) I branched off to create handgrading from develop in my fork, (2) I started a PR from my handgrading branch to the origin's develop branch, and (3) a PR from my develop branch to the origin's develop branch got merged. Other users have had the same issue.

We can either duplicate this pull request or have you temporarily turn off "Dismiss stale pull request approvals when new commits are pushed".

@james-perretta
Copy link
Contributor

james-perretta commented Apr 24, 2024 via email

@Normanwqn
Copy link
Contributor

@james-perretta We have submitted another PR here . We wold appreciate it if you may take a look. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local score update when applying annotations past the max deduction is incorrect
3 participants