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

Add Picnic shopping cart as Todo list #102855

Merged
merged 10 commits into from
Nov 22, 2023

Conversation

DCSBL
Copy link
Contributor

@DCSBL DCSBL commented Oct 26, 2023

Proposed change

Add new Todo entity for Picnic.

The new todo list is a bit limited for the needs, but you can get a nice overview of what is in your cart.

Screenshot 2023-11-22 at 09 18 14

Limitations

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @corneyl, mind taking a look at this pull request as it has been labeled with an integration (picnic) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of picnic can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign picnic Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@DCSBL
Copy link
Contributor Author

DCSBL commented Oct 26, 2023

As reference;

@DCSBL DCSBL changed the title Picnic shopping cart Add Picnic shopping cart as Todo list Oct 26, 2023
tests/components/picnic/test_todo.py Outdated Show resolved Hide resolved
homeassistant/components/picnic/todo.py Show resolved Hide resolved
homeassistant/components/picnic/todo.py Outdated Show resolved Hide resolved
tests/components/picnic/test_todo.py Outdated Show resolved Hide resolved
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft October 27, 2023 20:01
@DCSBL DCSBL marked this pull request as ready for review October 28, 2023 09:45
@home-assistant home-assistant bot requested a review from edenhaus October 28, 2023 09:45
def todo_items(self) -> list[TodoItem] | None:
"""Get the current set of items in cart items."""
if self.coordinator.data is None:
return None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note that none of the To-do have this one covered.

Copy link
Contributor

@allenporter allenporter 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. Just one suggestion of a minor typo i think

homeassistant/components/picnic/todo.py Outdated Show resolved Hide resolved
@allenporter allenporter added the noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Nov 12, 2023
@DCSBL
Copy link
Contributor Author

DCSBL commented Nov 20, 2023

@edenhaus Can you take a quick look at this again?

Copy link
Contributor

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

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

Thanks @DCSBL 👍

Would it be possible to update the screenshot in the description? ( I removed it as it is not up to date)

@edenhaus edenhaus merged commit af15aab into home-assistant:dev Nov 22, 2023
19 of 20 checks passed
@DCSBL DCSBL deleted the picnic-shopping-cart branch November 22, 2023 08:19
@DCSBL
Copy link
Contributor Author

DCSBL commented Nov 22, 2023

Thanks! Screenshot is updated!

--

Follow-up is also updated and ready for review, this allows adding items in the same way as the existing service by Picnic → #102862

@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2023
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Please address the comments in a new PR. Thanks!

async_add_entities([PicnicCart(picnic_coordinator, config_entry)])


class PicnicCart(TodoListEntity, CoordinatorEntity):
Copy link
Member

Choose a reason for hiding this comment

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

Please invert the inheritance order.

Copy link
Member

Choose a reason for hiding this comment

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

Also add a type annotation to the generic CoordinatorEntity what coordinator type it holds.

TodoItem(
summary=f"{article['name']} ({article['unit_quantity']})",
uid=f"{item['id']}-{article['id']}",
status=TodoItemStatus.NEEDS_ACTION, # We set 'NEEDS_ACTION' so they count as state
Copy link
Member

Choose a reason for hiding this comment

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

Please move the comment above the line to decrease the line length.

@home-assistant home-assistant unlocked this conversation Feb 18, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed Hacktoberfest has-tests integration: picnic new-feature noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) Quality Scale: No score
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants