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

Tutorial groups: Allow to export information #8707

Merged
merged 31 commits into from
Jun 27, 2024

Conversation

az108
Copy link
Contributor

@az108 az108 commented May 31, 2024

Checklist

General

Client

Motivation and Context

This PR solves the issue mentioned in: #8681
where it is mentioned why not being able to export tutorial groups is a tendious process.

Description

I added a export button which opens a modal view where a instructor can choose which information he/she wants to export to a CSV/JSON. This is done via checkboxes. A select all button was also implemented if you do not want to tick all checkboxes manually. The information on which checkboxes are crossed is then sent to the server and parsed there. After creating the CSV/JSON the response is sent back to the client where the file is then downloaded.

Before:
image
After:
image
image

Steps for Testing

  • Click on some Course: Click on a Course where you have instructor rights
  • Navigate to Manage: Click on the Manage Icon
  • Navigate to Tutorials: Click on the Manage Section
  • Enable Tutorials: Provide a basic configuration by entering dates
  • Create a test Tutorial: Create a tutorial
  • Try to Export: Use the button and try out various combinations on exporting the information to a CSV/JSON
  • Try it with Students: Register some students to the tutorial and then try the student checkbox. Verify that if no student is registered the CSV/JSON output is empty, containing only the tutorials as rows and if students are registered the CSV contains multiple rows with the correct information and all students are listed in the JSON. The behaviour that the first output row for a tutorial in a CSV row does not contain student information is intended.

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 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

Test Coverage

Client

Class/File Line Coverage Confirmation (assert/expect)
tutorial-groups.service.ts 90.9%
tutorial-groups-export-button.component.ts 98.43%

Server

Class/File Line Coverage Confirmation (assert/expect)
TutorialGroupService.java 94%
TutorialGroupResource.java 91%

@az108 az108 requested a review from a team as a code owner May 31, 2024 17:17
@az108 az108 linked an issue May 31, 2024 that may be closed by this pull request
@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels May 31, 2024
Copy link

coderabbitai bot commented May 31, 2024

Walkthrough

The recent updates introduce new functionalities for exporting tutorial group data to CSV and JSON formats. This involves changes in the service classes, REST endpoints, Angular components, and associated test cases. Localized strings for export dialogs in both German and English are added for better user experience. The new functionalities enable instructors to export detailed tutorial group and student data selectively.

Changes

File(s) Change Summary
src/main/java/de/tum/in/www1/artemis/service/tutorialgroups/TutorialGroupService.java Added methods for exporting tutorial groups to CSV and JSON formats, including utility methods for processing data and configuring export fields.
src/main/java/de/tum/in/www1/artemis/web/rest/tutorialgroups/TutorialGroupResource.java Added REST endpoints for exporting tutorial groups to CSV and JSON with appropriate configurations and annotations.
src/test/java/de/tum/in/www1/artemis/tutorialgroups/TutorialGroupIntegrationTest.java Introduced tests for day of week conversion, and for exporting tutorial groups to CSV and JSON, including content verification.
src/main/webapp/app/course/tutorial-groups/.../tutorial-groups-export-button.component.html Introduced the HTML template for export buttons and dialog, including event bindings for interaction and selection of export fields.
src/main/webapp/app/course/tutorial-groups/.../tutorial-groups-export-button.component.ts Added Angular component logic to facilitate exporting tutorial group data, including field selection, export handling in CSV and JSON formats, and dialog management.
src/main/webapp/i18n/de/tutorialGroupExport.json Added German localization strings for the export dialog, including textual content for buttons, headers, descriptions, tooltips, and error messages related to CSV/JSON exports.
src/main/webapp/i18n/en/tutorialGroupExport.json Added English localization strings for the export dialog, providing content for buttons, headers, descriptions, tooltips, and error messages related to CSV/JSON exports.
src/test/javascript/spec/component/tutorial-groups/services/tutorial-group.service.spec.ts Added tests for export functionalities to CSV and JSON formats, import capabilities, language value retrieval, and date conversion methods for tutorial groups and sessions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as Export Button UI
    participant AngularSvc as Angular Service
    participant Backend as Backend Service

    User->>+UI: Click "Export" Button
    UI->>+UI: Open Export Dialog
    User->>+UI: Select Fields and Format (CSV/JSON)
    UI->>+AngularSvc: Call export method with selected fields and format
    AngularSvc->>+Backend: HTTP GET "/courses/{courseId}/tutorial-groups/export/{format}?fields={fields}"
    
    Backend-->>-AngularSvc: Return exported data
    AngularSvc-->>-UI: Trigger download of exported file
    UI-->>-User: File Downloaded
Loading

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: 8

az108 and others added 5 commits May 31, 2024 19:43
Update german translation

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…agement/tutorial-groups/tutorial-groups-management/tutorial-groups-export-button.component/tutorial-groups-export-button.component.ts


remove unnecessary import

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes May 31, 2024
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: 1

Outside diff range comments (1)
src/test/javascript/spec/component/tutorial-groups/tutorial-groups-management/tutorial-groups/tutorial-groups-management/tutorial-groups-management.component.spec.ts (1)

Line range hint 1-1: What light through yonder window breaks? It is the east, and Juliet is the sun. Optimize thy imports, for they do clutter more than they enlighten!

- import { ComponentFixture, TestBed } from '@angular/core/testing';
+ import type { ComponentFixture, TestBed } from '@angular/core/testing';

coderabbitai[bot]
coderabbitai bot previously approved these changes May 31, 2024
Copy link
Contributor

@egekurt123 egekurt123 left a comment

Choose a reason for hiding this comment

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

Reapprove

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.

re-approve

Copy link

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Jun 21, 2024
@az108 az108 removed the deployment-error Added by deployment workflows if an error occured label Jun 22, 2024
Copy link
Contributor

@sarpsahinalp sarpsahinalp left a comment

Choose a reason for hiding this comment

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

Reapprove

Copy link
Contributor

@MarkusPaulsen MarkusPaulsen 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 + tested on TS2

For future follow-up: Make "Students" in the JSON-file contain a list, not a comma separated string.

@MarkusPaulsen MarkusPaulsen added maintainer-approved The feature maintainer has approved the PR and removed lock:artemis-test2 labels Jun 24, 2024
@az108 az108 added ready to merge maintainer-approved The feature maintainer has approved the PR and removed maintainer-approved The feature maintainer has approved the PR ready for review labels Jun 24, 2024
@krusche krusche added this to the 7.3.1 milestone Jun 27, 2024
@krusche krusche merged commit d065570 into develop Jun 27, 2024
78 of 91 checks passed
@krusche krusche deleted the feature/add-export-functionality-for-tutorial-groups branch June 27, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) maintainer-approved The feature maintainer has approved the PR ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add Export functionality for tutorial Details