Skip to content

Implement stats #2

Description

@codercody

We want to be able to show stats about a user's preferences. Maybe we can start with showing favorite and least favorite tags. To implement this, we should do the following:

  1. Add an endpoint the server for getting stats. For instance /instagram/stats. All it should do is get the instagram username from the request, call hungryai.something(instagramUsername), and then res.send() the result
  2. Add a library function to services/hungryai.js. For instance getStats(instagramUsername), and it'll return a json of a couple stats.
  3. First get the user associated with that instagramUsername from Mongo using User.findOne
  4. Then get all the reviews associated with that from Mongo using using Review.find
  5. Then for each review, get all the tags associated with review.image using GoogleImageTags.findOne. Check models/Tag.js to see what that return value will look like
  6. For all the tags you get from steps 4+5, return the top 10 with the highest average ratings and the bottom 10 with the lowest average ratings

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions