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

Programming exercises: Avoid nested zip for each submission repository in the export #8576

Merged
merged 15 commits into from
Jun 2, 2024

Conversation

BaumiCoder
Copy link
Member

@BaumiCoder BaumiCoder commented May 12, 2024

Checklist

General

Server

  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

Client

No changes in the client

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server my local machine configured with Gitlab and Jenkins.

Motivation and Context

If you download one or more student submission repositories to look at them with your IDE,
you get a zip form Artemis, which contains several zip-files. One for each student.
The additional step to unzip is annoying and wastes time (see #7732).

(The creating of the sub-zip files also waste some computation power on the Artemis server.)

Description

To not zip submission repositories, if they get zip together in the next step.
This applies to:

  1. Download of submission to programming exercises at Scoring list
  2. Archive a course with submissions to a programming exercises
  3. Archive an exam with submissions to a programming exercises

(The exercise, test and solution repositories are still zipped again. So there is no breaking change in the download format for programming exercises, which can be imported again into Artemis.)

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • 1 Course
  1. Log in to Artemis with the Instructor account
  2. Navigate to Course Administration of your Course
  3. Create a new programming exercise (recommendation: ✔️ Allow Online Editor)
  4. Make a submission with both Student account
  5. Go to the Scores page of the exercise
  6. Click Export - Download Repos
  7. Download the repositories of all students (or maybe also try only one student)
  8. Check that the downloaded zip contains directories for each student and not zip files
  9. Navigate to Course Administration of your Course
  10. Set the end date of your course to now
  11. Click on Archive Course
  12. Confirm the message and wait for the progress to finish
  13. Click on Download Archive
  14. In the zip file you can find a directory for your exercise. Check that it contains directories for each student and not zip files (zip files for exercise, test and solution are by design.)

Exam Mode Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  1. Log in to Artemis with the Instructor account
  2. Create an exam for one exercise in it
  3. Create an exercise group and a programming exercise in it with 1 maximal point (recommendation: ✔️ Allow Online Editor)
  4. Add both student account to the exam and generate their exams
  5. Participant in the exam with both student accounts including a submission to the exercise
  6. Set all ends of the exam to now
  7. Archive the exam
  8. Click on Archive Exam
  9. Confirm the message and wait for the progress to finish
  10. Click on Download Archive
  11. In the zip file you can find a directory for your exercise. Check that it contains directories for each student and not zip files (zip files for exercise, test and solution are by design.)

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked






Review Progress

Performance Review

  • 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

Class/File Line Coverage Confirmation (assert/expect)
GitService.java 85.10%
AthenaRepositoryExportService.java 94.74%
ProgrammingExerciseExportService.java 69.47%

The Path to the zip is the result of the function.
There is no list (anymore).
ToDo: Adjust the callers of
ProgrammingExerciseExportService.exportStudentRepositories
(and check if all are fine with getting directories).
Adjust the callers of
ProgrammingExerciseExportService.exportStudentRepositories
to make clear that it now returns list of directories
instead of zip files.
Fix: For constant values "eq()" have to been used.

Add: Also provide a mocked result for not zipped output. Some of
the tests seems to consider filenames.
@BaumiCoder BaumiCoder self-assigned this May 12, 2024
@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) labels May 12, 2024
Test this method of the GitService directly to be apple to cover all
cases of parameter combination. (Actual no test calls the method with
zipOutput).
@BaumiCoder BaumiCoder marked this pull request as ready for review May 27, 2024 15:36
@BaumiCoder BaumiCoder requested a review from a team as a code owner May 27, 2024 15:36
Copy link

coderabbitai bot commented May 27, 2024

Walkthrough

The changes in this update primarily focus on modifying the GitService class by renaming the zipRepositoryWithParticipation method to getRepositoryWithParticipation and adding a new parameter to control the output format. This change cascades through various services and tests, updating method calls and expected outputs accordingly. Additionally, test files have been adjusted to align with the new method signature and logic.

Changes

File Path Change Summary
.../service/connectors/GitService.java Renamed zipRepositoryWithParticipation to getRepositoryWithParticipation and added zipOutput parameter. Adjusted logic for file name generation.
.../service/connectors/athena/AthenaRepositoryExportService.java Updated method call to getRepositoryWithParticipation with new parameter.
.../service/export/ProgrammingExerciseExportService.java Renamed shouldZipZipFiles to shouldZipDirs in method signatures. Adjusted return type of exportStudentRepositories. Updated method call to getRepositoryWithParticipation.
.../exercise/programming/GitServiceTest.java Added new test method testGetRepositoryWithParticipation and necessary imports.
.../exercise/programming/ProgrammingExerciseTestService.java Updated file path matching conditions in test method. Adjusted regex patterns for expected file names.
.../exercise/programming/ProgrammingExerciseUtilService.java Modified method call to getRepositoryWithParticipation with new parameter and adjusted return values.
.../service/DataExportCreationServiceTest.java Changed verification logic from zip file to directory check.
.../util/GitUtilService.java Added imports and methods to initialize a repository for a programming exercise participation.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant AthenaRepositoryExportService
    participant GitService

    User ->> AthenaRepositoryExportService: exportRepository()
    AthenaRepositoryExportService ->> GitService: getRepositoryWithParticipation(repo, dir, hideName, true)
    GitService -->> AthenaRepositoryExportService: zipFilePath
    AthenaRepositoryExportService -->> User: zipFilePath

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Outside diff range and nitpick comments (2)
src/main/java/de/tum/in/www1/artemis/service/export/ProgrammingExerciseExportService.java (2)

138-144: Consider adding a detailed JavaDoc for the parameter shouldZipDirs.

Adding a more detailed JavaDoc comment for the shouldZipDirs parameter could improve code readability and maintainability, especially for new developers or external contributors who might work with this code in the future.


689-697: Clarify the behavior when zipOutput is false.

The method getRepositoryWithParticipation could benefit from a clearer explanation in the JavaDoc about what happens when zipOutput is false. It's important for maintainability that the behavior of such a key parameter is well-documented.

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

Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

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

tested in testing session, works as described

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

tested in testing session, works as intended

Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Code 👍

Copy link
Contributor

@undernagruzez undernagruzez 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, left one small suggestion
also tested during a testing session, works as expected

@b-fein b-fein added this to the 7.1.2 milestone May 30, 2024
@b-fein b-fein changed the title Programming exercises: Avoid zip for each submission repository Programming exercises: Avoid nested zip for each submission repository Jun 1, 2024
@krusche krusche merged commit 85f3776 into develop Jun 2, 2024
33 of 44 checks passed
@krusche krusche deleted the bugfix/programming-exercises/avoid-zip-for-each-repo branch June 2, 2024 17:03
@krusche krusche changed the title Programming exercises: Avoid nested zip for each submission repository Programming exercises: Avoid nested zip for each submission repository in the export Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:Programming ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

Programming exercises: Student repo download has nested zip-in-zip-file instead of only zipped repo
8 participants