getProductImprovements method
Returns all the potential improvements given the quality of the data
For apps with contribution mode. A typical use-case is to alert the end-users that they can improve the quality of the OFF data by taking pictures (or something like that), when displaying a Product.
Implementation
Set<ProductImprovement> getProductImprovements() {
final Set<ProductImprovement> result = {};
if (statesTags == null) {
return result;
}
if (statesTags!.contains('en:origins-to-be-completed')) {
result.add(ProductImprovement.ORIGINS_TO_BE_COMPLETED);
}
if (statesTags!.contains('en:categories-completed')) {
if (nutriscore == null) {
result.add(ProductImprovement.CATEGORIES_BUT_NO_NUTRISCORE);
}
if (statesTags!.contains('en:nutrition-facts-to-be-completed')) {
result.add(ProductImprovement.ADD_NUTRITION_FACTS);
}
}
if (statesTags!.contains('en:categories-to-be-completed')) {
if (statesTags!.contains('en:nutrition-facts-completed')) {
result.add(ProductImprovement.ADD_CATEGORY);
}
if (statesTags!.contains('en:nutrition-facts-to-be-completed')) {
result.add(ProductImprovement.ADD_NUTRITION_FACTS_AND_CATEGORY);
}
}
if (statesTags!.contains('en:nutrition-photo-to-be-selected') ||
statesTags!.contains('en:photos-to-be-uploaded')) {
result.add(ProductImprovement.OBSOLETE_NUTRITION_IMAGE);
}
// TODO (Optional) Add Nutri-Score disclaimers cf. https://github.com/openfoodfacts/openfoodfacts-dart/issues/193
return result;
}