Skip to content

Instantly share code, notes, and snippets.

@GeneralistDev
Created November 5, 2016 02:10
Show Gist options
  • Save GeneralistDev/81f6d543c4e0ebb1c52397c8af5435ed to your computer and use it in GitHub Desktop.
Save GeneralistDev/81f6d543c4e0ebb1c52397c8af5435ed to your computer and use it in GitHub Desktop.
function getMostPopularForCourse(courseId, tag) {
var questionsNode =
tag ?
ref.child('discussions').child('byCourseByTag').child(courseId).child(tag)
: ref.child('discussions').child('byCourse').child(courseId);
// create a query for the most popular messages on the server
var query = questionsNode.orderByChild("voteSum")
return $firebaseArray(query.limitToLast(pagingOptions.count));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment