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

File upload exercises: Fix an issue with old file submissions not being deleted #7276

Conversation

theblobinthesky
Copy link
Contributor

@theblobinthesky theblobinthesky commented Sep 27, 2023

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I followed the coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I followed the coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Changes affecting Programming Exercises

  • I tested all changes and their related features with all corresponding user types on Test Server 1 (Atlassian Suite).
  • I tested all changes and their related features with all corresponding user types on Test Server 2 (Jenkins and Gitlab).

Motivation and Context

This fixes the issue #7275.

Description

The FileUploadSubmission class contains the filePath attribute which is a public path and has to be converted to an actual path on the file system before being used. In this case the onDelete() function did not convert the path and therefore no old submission file from a file upload exercise could ever be deleted.
I think this is where the breaking change happened: aca8f44#diff-afbf7c4cfa2c701ea17f5d3fc9cae4f94e88f182921364471f35e9f3355e0302R37
Since i wanted to avoid using the FilePathService inside of an entity, i reverted back to the implementation before it broke.
I also added an error message to FileService's schedulePathForDeletion when the file to-be-deleted does not exist to catch such errors reliably in the future.

Steps for Testing

Prerequisites:

  • 1 Student
  • 1 Programming Exercise with Complaints enabled
  1. Upload a file to the file upload exercise.
  2. Upload another file to replace the old submission.
  3. Acknowledge the old submission file has been deleted and only the new one is left.

Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Test Coverage

Screenshots

@theblobinthesky theblobinthesky requested a review from a team as a code owner September 27, 2023 12:27
@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Sep 27, 2023
@theblobinthesky theblobinthesky marked this pull request as draft September 27, 2023 12:27
@theblobinthesky theblobinthesky changed the title File Upload : New file submission in file upload exercise does not delete old submission file File Upload: New file submission in file upload exercise does not delete old submission file Sep 27, 2023
@theblobinthesky theblobinthesky changed the title File Upload: New file submission in file upload exercise does not delete old submission file File Upload Exercise: New file submission in file upload exercise does not delete old submission file Sep 27, 2023
@theblobinthesky theblobinthesky marked this pull request as ready for review September 27, 2023 12:40
@krusche krusche changed the title File Upload Exercise: New file submission in file upload exercise does not delete old submission file File upload exercise: Fix an issue with old file submissions not being deleted Sep 27, 2023
@krusche krusche changed the title File upload exercise: Fix an issue with old file submissions not being deleted File upload exercise: Fix an issue with old file submissions not being deleted Sep 27, 2023
@krusche krusche changed the title File upload exercise: Fix an issue with old file submissions not being deleted File upload exercises: Fix an issue with old file submissions not being deleted Sep 27, 2023
@b-fein b-fein added the bugfix label Sep 27, 2023
Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

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

Code looks good to me

Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

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

code lgtm

@krusche krusche added this to the 6.5.4 milestone Oct 3, 2023
@krusche krusche merged commit 6346cfc into ls1intum:develop Oct 3, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix ready for review server Pull requests that update Java code. (Added Automatically!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New file submission in file upload exercise does not delete old submission file
5 participants