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: #2833 - KP page refreshed by product (refactoring was needed) #2861

Merged
merged 3 commits into from Sep 7, 2022

Conversation

monsieurtanuki
Copy link
Contributor

Impacted files:

  • knowledge_panel_card.dart: refactored the call to KnowledgePanelPage
  • knowledge_panel_element_card.dart: refactored the calls to KnowledgePanelCard and KnowledgePanelGroupCard
  • knowledge_panel_expanded_card.dart: refactored the call to KnowledgePanelElementCard
  • knowledge_panel_group_card.dart: refactored the call to KnowledgePanelCard
  • knowledge_panel_page.dart: refactored the call to KnowledgePanelExpandedCard; we use a Consumer in order to refresh when the product is refreshed
  • knowledge_panel_page_template.dart; refactored the call to KnowledgePanelWidget
  • knowledge_panels_builder.dart: refactored the call to KnowledgePanelElementCard
  • new_product_page.dart: refactored the call to KnowledgePanelWidget
  • simple_input_page.dart: unrelated "vertical axis" for verbose buttons
  • summary_card.dart: refactored the call to KnowledgePanelPage

What

  • The knowledge panel page now reflects the latest value of the product - e.g. when the user (from the KP page) added a category to the product (which impacted the score) and went back to the KP page.
  • Once upon a time the KP was not part of the product, which meant that we had to carry both the KP value and the product to display a KP. Now that KP is a field of the product, we just need to pass the product and the String panelId.
  • The PR needed that refactoring, in order to get the fresh KP from the refreshed product.

Screenshot

While fixing the issue, I also improved a dialog display:

before after
Capture d’écran 2022-08-30 à 08 27 03 Capture d’écran 2022-08-30 à 08 29 13

Fixes bug(s)

…as needed)

Impacted files:
* `knowledge_panel_card.dart`: refactored the call to  `KnowledgePanelPage`
* `knowledge_panel_element_card.dart`: refactored the calls to `KnowledgePanelCard` and `KnowledgePanelGroupCard`
* `knowledge_panel_expanded_card.dart`: refactored the call to `KnowledgePanelElementCard`
* `knowledge_panel_group_card.dart`: refactored the call to `KnowledgePanelCard`
* `knowledge_panel_page.dart`: refactored the call to `KnowledgePanelExpandedCard`; we use a `Consumer` in order to refresh when the product is refreshed
* `knowledge_panel_page_template.dart`; refactored the call to `KnowledgePanelWidget`
* `knowledge_panels_builder.dart`: refactored the call to `KnowledgePanelElementCard`
* `new_product_page.dart`: refactored the call to `KnowledgePanelWidget`
* `simple_input_page.dart`: unrelated "vertical axis" for verbose buttons
* `summary_card.dart`: refactored the call to `KnowledgePanelPage`
@codecov-commenter
Copy link

Codecov Report

Merging #2861 (5f1fc30) into develop (283cda6) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           develop   #2861      +/-   ##
==========================================
- Coverage     6.94%   6.94%   -0.01%     
==========================================
  Files          229     229              
  Lines        11155   11156       +1     
==========================================
  Hits           775     775              
- Misses       10380   10381       +1     
Impacted Files Coverage Δ
...e_panel/knowledge_panels/knowledge_panel_card.dart 0.00% <0.00%> (ø)
...knowledge_panels/knowledge_panel_element_card.dart 0.00% <0.00%> (ø)
...nowledge_panels/knowledge_panel_expanded_card.dart 0.00% <0.00%> (ø)
...l/knowledge_panels/knowledge_panel_group_card.dart 0.00% <ø> (ø)
...e_panel/knowledge_panels/knowledge_panel_page.dart 0.00% <0.00%> (ø)
.../lib/knowledge_panel/knowledge_panels_builder.dart 0.00% <0.00%> (ø)
...ages/onboarding/knowledge_panel_page_template.dart 0.00% <0.00%> (ø)
...smooth_app/lib/pages/product/new_product_page.dart 0.00% <0.00%> (ø)
...mooth_app/lib/pages/product/simple_input_page.dart 0.00% <ø> (ø)
...ges/smooth_app/lib/pages/product/summary_card.dart 0.00% <0.00%> (ø)
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @monsieurtanuki

@monsieurtanuki monsieurtanuki merged commit e57cc0f into openfoodfacts:develop Sep 7, 2022
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev!

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.

The app should refresh sub-knowledge panels after category addition
4 participants