Skip to content

100 - CSV Download of gradebook #250

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

dvcabiya
Copy link
Contributor

@dvcabiya dvcabiya commented Apr 9, 2025

Added support for downloading gradebooks to csv files, and fixed some text field styling in various places across the site, made submissions clickable from anywhere on the card, updated due date printing to show time correctly.

Proposed changes


Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.

If it fixes a bug or resolves a feature request, be sure to link to that issue using #{issue_number}.

Types of changes


What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist


Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, don't hesitate to ask. This is simply a reminder of what we are going to look for before merging your code.

  • My changeset covers only what is described above (no extraneous changes)
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Copy link
Member

@NicholasMy NicholasMy left a comment

Choose a reason for hiding this comment

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

Looks good overall. I made some cleanup suggestions.

Comment on lines +14 to +16
let updatedTime = new Date(date)
updatedTime.setHours(updatedTime.getHours() + 4) // jank fix, but makes due dates appear correctly :D
return updatedTime.toLocaleString('en-us', {
Copy link
Member

Choose a reason for hiding this comment

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

As we discussed, this needs to be updated to display the time to the local timezone. The database should store everything in UTC time, and the browser should display it in the local timezone.

Comment on lines +115 to +120
const link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", `${courseName.replace(" ", '').toLowerCase() ?? 'class'}_gradebook`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
Copy link
Member

Choose a reason for hiding this comment

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

This might be okay for now, but there must be a better way to do this than temporarily creating a link and simulating it being clicked.

Comment on lines +207 to +212
const link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", `${course?.number.replace(" ", '').toLowerCase() ?? 'class'}_gradebook`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
Copy link
Member

Choose a reason for hiding this comment

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

There's a lot of duplicate code here (from the student gradebook page). It would be good to abstract common logic out to a utility function.

@@ -68,7 +68,7 @@ const TextProblemModal = ({ open, onClose }: Props) => {
await RequestService.post(`/api/course/${courseId}/assignment/${assignmentId}/non-container-auto-graders/`, graderFormData)
.then(() => {
console.log("GRADER CREATED")
window.location.reload()
//window.location.reload()
Copy link
Member

Choose a reason for hiding this comment

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

Cleanup

@@ -277,19 +276,18 @@ const AssignmentDetailPage = () => {
</div>
</div>



{submissions.length != 0 &&
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{submissions.length != 0 &&
{submissions.length !== 0 &&

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.

2 participants