From 9bf40c2c0d4eb7176652ced9806955f251311059 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 23 Oct 2016 16:23:16 -0400 Subject: [PATCH] improve duplicate function --- hourglass/server/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 77ed50f..8102297 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -180,7 +180,9 @@ Meteor.methods({ privacy: false, teacher: input.teacher, hour: input.hour - }).fetch().length < 1) { + }).fetch().length < 1 || + input.teacher === "" || + input.hour === "") { input.status = Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']); input.admin = Meteor.userId(); Meteor.call('genCode', function(error, result) { @@ -197,7 +199,7 @@ Meteor.methods({ Meteor.call('joinClass', [result, input.code]); }); } else { - throw new Meteor.Error("overlap", "This teacher is already teaching a class elsewhere!") + throw new Meteor.Error("overlap", "This teacher is already teaching a class elsewhere!"); } } else {