Use new refactored API

This commit is contained in:
Yarne Coppens 2024-08-22 14:10:17 +02:00
parent 1bd2f84d91
commit 050638ae43
2 changed files with 9 additions and 3 deletions

View file

@ -171,6 +171,12 @@ async function create_multiple_boardgame_chart(url, card_to_fill, footer_attribu
}
function footer_attribute_to_value(obj, footer_attribute){
if (!footer_attribute) return obj;
const properties = footer_attribute.split('.');
return footer_attribute_to_value(obj[properties.shift()], properties.join('.'))
}
statistic_data = await makeRequest(url)
const card_header = document.createElement('div')
@ -195,7 +201,7 @@ async function create_multiple_boardgame_chart(url, card_to_fill, footer_attribu
if (footer_attribute != ''){
for (boardgame_index in boardgames_to_grid){
let footer_string = boardgames_to_grid[boardgame_index][footer_attribute]
let footer_string = footer_attribute_to_value(boardgames_to_grid[boardgame_index], footer_attribute)
if (footer_preamble != ''){
footer_string = footer_preamble + footer_string
}
@ -247,7 +253,7 @@ async function loadStatistics(){
const most_expensive_games_card = most_expensive_games_card_col.firstChild
statistic_row.appendChild(most_expensive_games_card_col)
const most_expensive_games_url = api_url + '/statistics/most_expensive_games?top_amount=6'
create_multiple_boardgame_chart(most_expensive_games_url, most_expensive_games_card, 'price_paid', '\u20AC ')
create_multiple_boardgame_chart(most_expensive_games_url, most_expensive_games_card, 'owned_info.price_paid', '\u20AC ')
const shelf_of_shame_card_col = create_statistic_card_col()

View file

@ -14,7 +14,7 @@ async function loadWishlistedGames() {
},
columns: [
{
data: 'wishlist_priority'
data: 'wishlist_info.wishlist_priority'
},
{
data: 'thumbnail_url',