prevent overlapping classes
This commit is contained in:
parent
d2dbdb0cd3
commit
2bfe58b3f1
@ -177,7 +177,7 @@
|
|||||||
{{#if noclass}}
|
{{#if noclass}}
|
||||||
<h3>No results found...</h3>
|
<h3>No results found...</h3>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each autocompleteClasses}}
|
{{#each autocompleteClasses}}
|
||||||
{{> classDisplay}}
|
{{> classDisplay}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|||||||
@ -175,21 +175,30 @@ Meteor.methods({
|
|||||||
schools.findOne({
|
schools.findOne({
|
||||||
name: input.school
|
name: input.school
|
||||||
})) {
|
})) {
|
||||||
input.status = Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']);
|
if (classes.find({
|
||||||
input.admin = Meteor.userId();
|
status: true,
|
||||||
Meteor.call('genCode', function(error, result) {
|
privacy: false,
|
||||||
input.code = result;
|
teacher: input.teacher,
|
||||||
});
|
hour: input.hour
|
||||||
if (input.category != "class" && input.category != "club") {
|
}).fetch().length < 1) {
|
||||||
input.category = "other";
|
input.status = Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']);
|
||||||
}
|
input.admin = Meteor.userId();
|
||||||
input.subscribers = [];
|
Meteor.call('genCode', function(error, result) {
|
||||||
input.moderators = [];
|
input.code = result;
|
||||||
input.banned = [];
|
});
|
||||||
|
if (input.category != "class" && input.category != "club") {
|
||||||
|
input.category = "other";
|
||||||
|
}
|
||||||
|
input.subscribers = [];
|
||||||
|
input.moderators = [];
|
||||||
|
input.banned = [];
|
||||||
|
|
||||||
classes.insert(input, function(err, result) {
|
classes.insert(input, function(err, result) {
|
||||||
Meteor.call('joinClass', [result, input.code]);
|
Meteor.call('joinClass', [result, input.code]);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
throw new Meteor.Error("overlap", "This teacher is already teaching a class elsewhere!")
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Meteor.Error("unauthorized", "You are not authorized to complete this action.");
|
throw new Meteor.Error("unauthorized", "You are not authorized to complete this action.");
|
||||||
@ -501,7 +510,7 @@ Meteor.methods({
|
|||||||
"hideReport": true
|
"hideReport": true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_.contains(superadmins, currentuser.services.google.email)) {
|
if (_.contains(superadmins, currentuser.services.google.email)) {
|
||||||
Roles.addUsersToRoles(userId, 'superadmin');
|
Roles.addUsersToRoles(userId, 'superadmin');
|
||||||
Roles.addUsersToRoles(userId, 'admin');
|
Roles.addUsersToRoles(userId, 'admin');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user