Fix daily upload counting

This commit is contained in:
Jonathan Cremin 2015-08-22 19:23:17 +01:00
parent d30b0987ad
commit 8e47c74b68
3 changed files with 4 additions and 3 deletions

View file

@ -58,7 +58,7 @@ export function* setupSession(user) {
'maxFileSize': 20971520,
'joined': user.joined,
'plan': user.type || 'Free',
'uploadsToday': 0,
'uploadsToday': yield this.db.Files.count({owner: user._id, 'time_added': {'$gt': Math.ceil(Date.now()/1000)-86400}}),
'token': token,
'md5': crypto.createHash('md5').update(user.email).digest('hex')
};

View file

@ -92,7 +92,8 @@
plan: "<%= user.plan %>",
maxFileSize: <%= user.maxFileSize %>,
token: "<%= user.token %>",
md5: "<%= user.md5 %>"
md5: "<%= user.md5 %>",
uploadsToday: "<%= user.uploadsToday %>"
};
</script>
<% } %>