jenkins-bot has submitted this change and it was merged.

Change subject: Fixes for nuclides to handle problem of duplicate (and some 
wrong) returns from SPARQL query
......................................................................


Fixes for nuclides to handle problem of duplicate (and some wrong) returns from 
SPARQL query

Change-Id: Ie27c4b8009273a3860fb836862c8a834bd2caa3b
---
M nuclides.py
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Ricordisamoa: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/nuclides.py b/nuclides.py
index 76d4622..c3f4a7b 100644
--- a/nuclides.py
+++ b/nuclides.py
@@ -171,10 +171,14 @@
         query_result = self.get_sparql(hl_query)
         for nuclide_result in query_result:
             nuclide_uri = nuclide_result['nuclide']['value']
+            if nuclide_result['half_life']['value'] == '0':
+                continue  # WDQS bug: values sometimes zero - skip
             if nuclide_uri in nuclides:
-                nuclides[nuclide_uri].half_life = time_in_seconds(
-                    nuclide_result['half_life']['value'],
-                    nuclide_result['half_life_unit']['value'])
+                if nuclides[nuclide_uri].half_life is None:
+                    nuclides[nuclide_uri].half_life = time_in_seconds(
+                        nuclide_result['half_life']['value'],
+                        nuclide_result['half_life_unit']['value'])
+                # else - sparql returned more than 1 half-life value - problem?
 
         decay_query = "PREFIX ps: <http://www.wikidata.org/prop/statement/> \
 PREFIX pq: <http://www.wikidata.org/prop/qualifier/> \

-- 
To view, visit https://gerrit.wikimedia.org/r/271551
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie27c4b8009273a3860fb836862c8a834bd2caa3b
Gerrit-PatchSet: 4
Gerrit-Project: labs/tools/ptable
Gerrit-Branch: master
Gerrit-Owner: ArthurPSmith <arthurpsm...@gmail.com>
Gerrit-Reviewer: ArthurPSmith <arthurpsm...@gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisa...@openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to