From ee67a18f0d162f1a4e12b40a1d8e0da8458e2f86 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sat, 16 Jan 2021 04:43:40 +0100 Subject: [PATCH] Fixed country code management. --- src/fr/devinsy/statoolinfos/core/Service.java | 7 ++++++- src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/core/Service.java b/src/fr/devinsy/statoolinfos/core/Service.java index 7a77fbd..0d50e1f 100644 --- a/src/fr/devinsy/statoolinfos/core/Service.java +++ b/src/fr/devinsy/statoolinfos/core/Service.java @@ -158,12 +158,17 @@ public class Service extends PathPropertyList { String result; - result = get("organization.country.code"); + result = StringUtils.toRootUpperCase(get("host.country.code")); // return result; } + /** + * Gets the crawled date. + * + * @return the crawled date + */ public LocalDateTime getCrawledDate() { LocalDateTime result; diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index 15abeeb..4490ba0 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -373,9 +373,12 @@ public class Htmlizer PieChart pie = new PieChart("Pays des services"); int index = 0; + int maxIndex = stats.keySet().size(); for (String country : stats.keySet()) { - pie.add(country, stats.get(country), ChartColor.values()[index]); + pie.add(country, stats.get(country), ChartColor.values()[index % maxIndex]); + + index += 1; } pie.setLegendPosition(Position.RIGHT);