diff --git a/modules/data.js b/modules/data.js index 813491a..f2acfa0 100644 --- a/modules/data.js +++ b/modules/data.js @@ -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, @@ -196,6 +210,7 @@ module.exports = { getObjectStats: getObjectStats, getObjectsInGalleryStats: getObjectsInGalleryStats, getCurrentExhibitions: getCurrentExhibitions, + getUpcomingExhibitions: getUpcomingExhibitions, getAltTextStats: getAltTextStats, getActivityStats: getActivityStats, getKeyStats: getKeyStats diff --git a/routes/index.js b/routes/index.js index 4211767..a6d6d5a 100644 --- a/routes/index.js +++ b/routes/index.js @@ -32,7 +32,8 @@ let data = { }, pageviews: {}, exhibitions: { - current: [] + current: [], + upcoming: [] } }; @@ -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, @@ -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']; diff --git a/views/production.hbs b/views/production.hbs index 4121a11..037bc51 100644 --- a/views/production.hbs +++ b/views/production.hbs @@ -73,10 +73,19 @@ +
+

Upcoming Exhibitions

+ + +
\ No newline at end of file