thamara / improved-bga-game-info-extension

See more information about a game in its page on BGA.
4 stars 2 forks source link

Display "best at" player count #3

Open thamara opened 3 years ago

thamara commented 3 years ago

From BGG's thread:

Would love to see the "best at" player count based on the poll under the number of players it supports.

thamara commented 3 years ago

The API from BGG gives:

Exaple: https://www.boardgamegeek.com/xmlapi2/thing?stats=1&id=182028

<poll name="suggested_numplayers" title="User Suggested Number of Players" totalvotes="584">
<results numplayers="1">
<result value="Best" numvotes="6"/>
<result value="Recommended" numvotes="11"/>
<result value="Not Recommended" numvotes="338"/>
</results>
<results numplayers="2">
<result value="Best" numvotes="153"/>
<result value="Recommended" numvotes="337"/>
<result value="Not Recommended" numvotes="37"/>
</results>
<results numplayers="3">
<result value="Best" numvotes="380"/>
<result value="Recommended" numvotes="138"/>
<result value="Not Recommended" numvotes="12"/>
</results>
<results numplayers="4">
<result value="Best" numvotes="90"/>
<result value="Recommended" numvotes="252"/>
<result value="Not Recommended" numvotes="153"/>
</results>
<results numplayers="4+">
<result value="Best" numvotes="0"/>
<result value="Recommended" numvotes="1"/>
<result value="Not Recommended" numvotes="311"/>
</results>
</poll>

We want to get what are the option of numplayer that have the highest votes on best. In this example, it would be numplayer=3.

The idea is to enhance the code in parseGamedataApiXml to be able to parse the numplayers data, stores it, and then show on the page.