Preferred rank values do not end up listed first in the Wikidata sync script output #10259
Labels
bug
javascript
Pull requests that update Javascript code
needs discussion
Waiting for other contributors to voice their opinion
There is code in
build_wikidata.js
that is intended to list values with preferred rank first in the Array generated bygetClaimValues()
:name-suggestion-index/scripts/build_wikidata.js
Lines 593 to 597 in f77b37a
However, in the final output of the Wikidata sync script (
dist/wikidata.json
), the Array has all values sorted alphabetically, not by rank or the order read by the script/order listed on Wikidata. For example, for Toys R Us Asia (Q131521392), theofficialWebsites
Array looks like this:This leads me to believe that something is rearranging the Array values somewhere between the call to
getClaimValues()
and the writing of the output files, and I suspect that it is the call tosortObject()
on line 638:name-suggestion-index/scripts/build_wikidata.js
Lines 609 to 657 in f77b37a
I think the ideal output would have the preferred rank value listed first and all other values sorted alphabetically, but I suspect that would require substantial code rewriting. In lieu of that, I can only think of two resolutions for this issue:
sortObject()
on line 638, putting preferred values first at the expense of leaving the rest of the Array values unsortedThe text was updated successfully, but these errors were encountered: