summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/views/index.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/server/lib/views/index.js b/server/lib/views/index.js
index 6ceef7e..8c3e63d 100644
--- a/server/lib/views/index.js
+++ b/server/lib/views/index.js
@@ -171,15 +171,20 @@ var views = module.exports = {
if ( ! isOwnProfile ) {
criteria.privacy = false
}
- views_middleware.fetchProjects(criteria, null, null, done)
+ views_middleware.fetchProjects(criteria, null, null, function(err, projects){
+ views_middleware.fetchUserProjectCount(criteria, function(projectCount){
+ done(err, projects, projectCount)
+ })
+ })
}
- function done(err, projects){
+ function done(err, projects, projectCount){
if (! user) { return res.redirect('/') }
res.render('profile', {
isOwnProfile: isOwnProfile,
profile: user,
projects: projects || [],
+ projectCount: projectCount,
ogTitle: "VValls: Profile of " + user.displayName,
ogUrl: "http://vvalls.com/profile/" + user.username + "/",
ogImage: user.photo,
@@ -240,5 +245,10 @@ var views_middleware = {
})
next(err, projects)
})
- }
+ },
+ fetchUserProjectCount: function(criteria, next){
+ Project.count(criteria, function(err, count){
+ next(count || 0)
+ })
+ },
}