Skip to content

Commit

Permalink
expand exhibition info
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsteward committed Sep 29, 2021
1 parent ce6896e commit 704ff41
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
15 changes: 15 additions & 0 deletions modules/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ function getCurrentExhibitions(callback) {
});
}

function getUpcomingExhibitions(callback) {
const params = {
venue: 'HAM',
status: 'upcoming'
};
const url = makeURL('exhibition', params);

fetch(url)
.then(response => response.json())
.then(results => {
callback(null, results['records']);
});
}

function getAltTextStats(callback) {
const params = {
size: 0,
Expand Down Expand Up @@ -196,6 +210,7 @@ module.exports = {
getObjectStats: getObjectStats,
getObjectsInGalleryStats: getObjectsInGalleryStats,
getCurrentExhibitions: getCurrentExhibitions,
getUpcomingExhibitions: getUpcomingExhibitions,
getAltTextStats: getAltTextStats,
getActivityStats: getActivityStats,
getKeyStats: getKeyStats
Expand Down
5 changes: 4 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ let data = {
},
pageviews: {},
exhibitions: {
current: []
current: [],
upcoming: []
}
};

Expand All @@ -47,6 +48,7 @@ router.get('/', function(req, res, next) {
async.parallel({
objectStats: stats.getObjectStats,
currentExhibitions: stats.getCurrentExhibitions,
upcomingExhibitions: stats.getUpcomingExhibitions,
alttextStats: stats.getAltTextStats,
objectsOnViewStats: stats.getObjectsInGalleryStats,
activityStats: stats.getActivityStats,
Expand All @@ -64,6 +66,7 @@ router.get('/', function(req, res, next) {
data.objects.onview.count_as_string = data.objects.onview.count.toLocaleString('en');
data.objects.onview.count_as_percent = ((results['objectsOnViewStats']/results['objectStats']['recordcount'])*100).toFixed(2);
data.exhibitions.current = results['currentExhibitions'];
data.exhibitions.upcoming = results['upcomingExhibitions'];
data.objects.alttext.count = results['alttextStats'];
data.objects.alttext.count_as_percent = ((data.objects.alttext.count/data.objects.count)*100).toFixed(2);
data.pageviews = results['activityStats']['pageviews'];
Expand Down
11 changes: 10 additions & 1 deletion views/production.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,19 @@

<ul class="list-group">
{{#each apistats.exhibitions.current}}
<li class="list-group-item"><a href="{{url}}">{{title}}</a></li>
<li class="list-group-item"><a href="{{url}}">{{title}}</a> <br/><span class="figure-caption">Closes on {{enddate}}</span></li>
{{/each}}
</ul>
</div>
<div class="card-body">
<h2 class="card-title">Upcoming Exhibitions</h2>

<ul class="list-group">
{{#each apistats.exhibitions.upcoming}}
<li class="list-group-item"><a href="{{url}}">{{title}}</a> <br/><span class="figure-caption">Opens on {{begindate}}</span></li>
{{/each}}
</ul>
</div>
</div>
</div>
</div>

0 comments on commit 704ff41

Please sign in to comment.