Commit 5ea9649e authored by Markus Shepherd's avatar Markus Shepherd

better presentation for designer stats

parent 1813e4a7
......@@ -177,7 +177,7 @@
<li class="nav-item {{ path === '/news' ? 'active' : '' }} text-nowrap">
<a href="/#/news"
class="nav-link">
News aggregator
News
<span ng-if="newsCount"
class="badge badge-light">
{{ newsCount &gt; 9 ? '9+' : newsCount }}
......
......@@ -418,8 +418,22 @@ ludojApp.factory('gamesService', function gamesService(
});
};
function addRanks(items, field) {
field = field || 'count';
_.forEach(items, function (item, i) {
item.rank = i === 0 || item[field] !== items[i - 1][field] ? i + 1 : items[i - 1].rank;
});
return items;
}
function processStats(stats) {
return processDate(stats, 'updated_at');
stats = processDate(stats, 'updated_at');
_.forEach(['rg', 'bgg'], function (site) {
_.forEach(['artist', 'category', 'designer', 'game_type', 'mechanic'], function (field) {
stats[site + '_top'][field] = addRanks(stats[site + '_top'][field]);
});
});
return stats;
}
service.getGamesStats = function getGamesStats(noblock) {
......
......@@ -38,8 +38,16 @@
role="tabpanel"
aria-labelledby="designers-rg-tab">
<ol class="mb-0">
<li ng-repeat="designer in data.rg_top.designer">
{{ designer.name }} ({{ designer.count }} games)
<li ng-repeat="designer in data.rg_top.designer"
value="{{ designer.rank }}">
<a ng-href="https://boardgamegeek.com/boardgamedesigner/{{ designer.bgg_id }}"
target="_blank">
<strong>
{{ designer.name }}
<i class="fas fa-external-link-alt"></i>
</strong>
</a>
({{ designer.count }} game{{ designer.count === 1 ? '' : 's' }})
</li>
</ol>
</div>
......@@ -48,8 +56,16 @@
role="tabpanel"
aria-labelledby="designers-bgg-tab">
<ol class="mb-0">
<li ng-repeat="designer in data.bgg_top.designer">
{{ designer.name }} ({{ designer.count }} games)
<li ng-repeat="designer in data.bgg_top.designer"
value="{{ designer.rank }}">
<a ng-href="https://boardgamegeek.com/boardgamedesigner/{{ designer.bgg_id }}"
target="_blank">
<strong>
{{ designer.name }}
<i class="fas fa-external-link-alt"></i>
</strong>
</a>
({{ designer.count }} game{{ designer.count === 1 ? '' : 's' }})
</li>
</ol>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment