diff --git a/commons/src/main/java/org/open4goods/model/product/AggregatedAttribute.java b/commons/src/main/java/org/open4goods/model/product/AggregatedAttribute.java index 9268ba8e..7cafa228 100644 --- a/commons/src/main/java/org/open4goods/model/product/AggregatedAttribute.java +++ b/commons/src/main/java/org/open4goods/model/product/AggregatedAttribute.java @@ -48,7 +48,47 @@ public class AggregatedAttribute implements IAttribute { private Set sources = new HashSet<>(); + /** + * Number of sources for this attribute + * @return + */ + public int sourcesCount() { + return sources.size(); + } + + /** + * The number of different values for this item + * @return + */ + public long distinctValues () { + return sources.stream().map(e-> e.getValue()).distinct().count(); + } + + public boolean hasConflicts() { + return distinctValues() > 1; + } + + public String bgRow() { + String ret="table-default"; + int sCount = sourcesCount(); + long dValues = distinctValues(); + + if (sCount == 0) { + ret="table-danger"; + } else if (sCount == 1) { + ret="table-default"; + } else { + ret="table-info"; + } + + if (dValues > 1) { + ret = "table-danger"; + } + + return ret; + } + // TODO : Simple, but does not allow to handle conflicts, and so on @Override public int hashCode() { diff --git a/ui/src/main/resources/i18n/messages_fr.properties b/ui/src/main/resources/i18n/messages_fr.properties index f232092a..5340f5e9 100644 --- a/ui/src/main/resources/i18n/messages_fr.properties +++ b/ui/src/main/resources/i18n/messages_fr.properties @@ -1,3 +1,5 @@ +attribute.sourcing = {0} source(s) de donnée(s), {1} conflit(s) + ecoscore.WARRANTY.tooltip = La garantie est de {0} an(s). ecoscore.DATA-QUALITY.tooltip = La qualité de la donnée est de {1} sur 5. ecoscore.REPAIRABILITY_INDEX.tooltip = L''indice de réparabilité est de {0} sur 10 ({1}/5 en valeur relative). diff --git a/ui/src/main/resources/templates/inc/product-unmatched-attributes.html b/ui/src/main/resources/templates/inc/product-unmatched-attributes.html index edd0a4c9..c80a0acb 100644 --- a/ui/src/main/resources/templates/inc/product-unmatched-attributes.html +++ b/ui/src/main/resources/templates/inc/product-unmatched-attributes.html @@ -1,7 +1,7 @@

Toutes les caractéristiques

- +
@@ -10,10 +10,19 @@ - - - - + + + + + + + + + + + + +
Nom