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

Fix: Select already existing due date chip when creating a custom chip. #1276

Merged
merged 1 commit into from
Jan 21, 2024

Conversation

Jonas-Sander
Copy link
Collaborator

@Jonas-Sander Jonas-Sander commented Jan 21, 2024

When trying to create a custom chip with the value of the already pre-existing chips, the pre-existing chips should be selected instead creating a custom chip and selecting both the pre-existing and new chip.

Fixes #1272

Summary by CodeRabbit

  • New Features

    • Enhanced homework dialog to prevent duplicate lesson chips.
  • Tests

    • Added regression tests for homework dialog chip creation and selection.

When trying to create a custom chip with the value of the already pre-existing chips, the pre-existing chips should be selected instead creating a custom chip and selecting both the pre-existing and new chip.

Fixes #1272
Copy link
Contributor

coderabbitai bot commented Jan 21, 2024

Walkthrough

The recent update to the application focuses on enhancing the user interface for homework scheduling. It introduces a logical check to prevent the duplication of scheduling chips when selecting a due date for homework. Additionally, the update includes regression tests to ensure the new functionality works as expected and that the specific lesson interval chips are created correctly.

Changes

File Path Change Summary
.../homework_dialog.dart Added platform_check import; updated addInXLessonsChip to prevent chip duplication.
.../homework_dialog_test.dart Added tests for verifying the creation and uniqueness of lesson interval chips.

Assessment against linked issues

Objective Addressed Explanation
[#1272]: Correct chip creation for "In 2 Stunden"
Ensure no duplicate chips are created

Poem

In the code where bugs hop away,
A 🐰 worked hard to patch and play.
With each click, no more dupe,
A chip for each lesson, in a happy loop.

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1770209 and f7526c7.
Files selected for processing (2)
  • app/lib/homework/homework_dialog/homework_dialog.dart (4 hunks)
  • app/test/homework/homework_dialog_test.dart (1 hunks)
Additional comments: 4
app/lib/homework/homework_dialog/homework_dialog.dart (2)
  • 27-27: The import statement for platform_check has been added. Ensure that this package is used within the file and that it is necessary for the changes made.
  • 516-526: The logic in addInXLessonsChip method now checks if a chip already exists before adding a new one. This change aligns with the PR objectives to prevent duplicate chips. However, ensure that the label for the new chip is consistent with the existing naming convention and that the selection of the chip is handled correctly.
app/test/homework/homework_dialog_test.dart (2)
  • 635-654: The test case starting at line 635 correctly sets up the necessary context and performs actions to simulate the issue described in the PR objectives. It verifies that selecting a custom chip for "in 2 lessons" results in the selection of the "Übernächste Stunde" chip without creating a new custom chip. The assertions at lines 652 and 653 confirm the expected behavior, which aligns with the PR's objectives.
  • 656-673: The test case starting at line 656 follows a similar pattern to the previous one, targeting the "in 1 lesson" scenario. It ensures that the "Nächste Stunde" chip is selected without creating a new custom chip. The assertions at lines 671 and 672 validate the correct behavior. This test case is well-structured and achieves the intended purpose of preventing duplicate chip creation.

Copy link

Visit the preview URL for this PR (updated for commit f7526c7):

https://sharezone-test--pr1276-fix-due-date-chip-se-6lvt8r9z.web.app

(expires Wed, 24 Jan 2024 18:03:49 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b

Copy link
Member

@nilsreichardt nilsreichardt left a comment

Choose a reason for hiding this comment

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

LGTM

@Jonas-Sander Jonas-Sander added this pull request to the merge queue Jan 21, 2024
Merged via the queue into main with commit 9a63c4b Jan 21, 2024
29 of 44 checks passed
@Jonas-Sander Jonas-Sander deleted the fix-due-date-chip-selection branch January 21, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When selecting "In 2 Stunden" a "2.-nächste Stunde" chip is created
2 participants