From b428045f9dbebf3d650adbc95925b5cc72aa51c1 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Tue, 11 Oct 2016 06:40:01 -0400 Subject: [PATCH] add graduation year on server --- hourglass/server/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hourglass/server/main.js b/hourglass/server/main.js index a27acf2..8c0afce 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -444,6 +444,7 @@ Meteor.methods({ // User Functions 'editProfile': function(change) { + var refyear = new Date().getUTCFullYear(); var current = Meteor.user().profile; current = { "__proto__": current.__proto__, @@ -458,6 +459,9 @@ Meteor.methods({ if (current.description && current.description.length > 50) { current.description = current.description.slice(0, 50); } + if (current.grade <= refyear || current.grade >= refyear + 4) { + current.grade = refyear; + } Meteor.users.update({ _id: Meteor.userId() }, {