-
Notifications
You must be signed in to change notification settings - Fork 12
Update Statistics To Realtime w/ Caching #194
base: staging
Are you sure you want to change the base?
Conversation
|
Slightly updated response format: |
Mail List fix
|
What's the status on this? |
YashoSharma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also are there no changes to the stats controller/service?
api/v1/controllers/RSVPController.js
Outdated
| const requests = require('../requests'); | ||
| const roles = require('../utils/roles'); | ||
| const mail = require('../utils/mail'); | ||
| const config = require('../../config'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx
api/v1/models/Stat.js
Outdated
| const Model = require('./Model'); | ||
| const validators = require('../utils/validators'); | ||
|
|
||
| const CATEGORIES = ['registration', 'rsvp', 'liveevent']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
live_event
api/v1/models/Stat.js
Outdated
| category: category, | ||
| stat: stat, | ||
| field: field | ||
| }).query().count().then((count) => _Promise.resolve(count[0]['count(*)'] > 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do .where().count()
api/v1/models/Stat.js
Outdated
| amount = 1; | ||
| } | ||
|
|
||
| const s = Stat.query((qb) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Stat.where().fetch().increment()
| .fetch(); | ||
| }; | ||
|
|
||
| TrackingEvent.findAll = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stats Service needs it to query all the tracked events and report the number of people who checked in.
api/v1/services/CheckInService.js
Outdated
| const credentialsRequested = attributes.credentialsRequested; | ||
| delete attributes.credentialsRequested; | ||
|
|
||
| StatsService.incrementStat('liveevent', 'attendees', 'count'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
live_event
api/v1/services/RSVPService.js
Outdated
| */ | ||
| module.exports.createRSVP = (attendee, user, attributes) => { | ||
|
|
||
| StatsService.incrementStat('rsvp', 'school', attendee.get('school')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preferably the controller has a const array which designates which fields to increment and then you can call the stat update function for-each element of the array
api/v1/services/TrackingService.js
Outdated
|
|
||
| currentEvent = result; | ||
|
|
||
| StatsService.incrementStat('liveevent', 'events', currentEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
live_event
|
|
||
| INSERT INTO `stats` (`category`, `stat`, `field`) VALUES ('liveevent', 'attendees', 'count'); | ||
|
|
||
| #INSERT INTO `stats` (`category`, `stat`, `field`) VALUES ('liveevent', `status`, `ACCEPTED`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaning up this sql table would be nice
Uh oh!
There was an error while loading. Please reload this page.