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: #3018 - storing the pending changes #3302

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

monsieurtanuki
Copy link
Contributor

New file:

  • dao_transient_operation.dart: Transient operation: a minimalist product with a key.

Impacted files:

  • barcode_product_query.dart: minor refactoring
  • local_database.dart: added reference to new class DaoTransientOperation
  • Podfile.lock: wtf
  • product_refresher.dart: minor refactoring
  • pubspec.lock: wtf

What

  • Here, the main change is the new class DaoTransientOperation, where we will store "minimalist" products
    • when we add a background task, the first thing we will do is to store the minimalist product there
    • until the background task is completed, this is where we'll find the pending changes, to be used by the app, that will show the product as stored as the downloaded product, with those pending changes on top
    • when the background task is completed we download the latest version of the product - at this moment we can remove the corresponding minimalist products as they are integrated into the latest downloaded version

Part of

New file:
* `dao_transient_operation.dart`: Transient operation: a minimalist product with a key.

Impacted files:
* `barcode_product_query.dart`: minor refactoring
* `local_database.dart`: added reference to new class `DaoTransientOperation`
* `Podfile.lock`: wtf
* `product_refresher.dart`: minor refactoring
* `pubspec.lock`: wtf
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.

Thanks @monsieurtanuki no real functionality change here. Just one little naming comment but feel free to ignore that. 👍🏼

return result;
}

Iterable<TransientOperation> getAll(final String barcode) {
Copy link
Member

Choose a reason for hiding this comment

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

From the name I would guess that it would return all TransientOperation's not only the ones for a specific product, not that important as the barcode is not optional.

@monsieurtanuki monsieurtanuki merged commit 316272e into openfoodfacts:develop Nov 10, 2022
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your review!
I understand your comment but on the other hand getAllForBarcode would be a bit verbose - and there's no plan for a getAll method without barcode either.
We'll see in the next steps, methods may be renamed later.

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.

2 participants