fixed createClass function
This commit is contained in:
parent
15bdca5b20
commit
45862fce0e
@ -18,13 +18,15 @@ Meteor.methods({
|
|||||||
return x.teacher;
|
return x.teacher;
|
||||||
}), true);
|
}), true);
|
||||||
classes.schema.validate(input);
|
classes.schema.validate(input);
|
||||||
if(Meteor.user() != null && classes.find({status:false, admin:Meteor.userId()}).length < 5 &&
|
if(Meteor.user() != null && classes.find({status:false, admin:Meteor.userId()}).fetch().length < 5 &&
|
||||||
schools.find({name:input.school}).fetch().length > 0 && input.status === true) {
|
schools.find({name:input.school}).fetch().length > 0 && input.status === false) {
|
||||||
|
|
||||||
input.subscribers = 0;
|
input.subscribers = 0;
|
||||||
input.admin = Meteor.userId()
|
input.admin = Meteor.userId()
|
||||||
if (input.privacy) {
|
if (input.privacy) {
|
||||||
input.code = genCode();
|
Meteor.call('genCode', function(error, result) {
|
||||||
|
input.code = result;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
input.code = "";
|
input.code = "";
|
||||||
}
|
}
|
||||||
@ -35,7 +37,7 @@ Meteor.methods({
|
|||||||
input.banned = []
|
input.banned = []
|
||||||
input.blockEdit = []
|
input.blockEdit = []
|
||||||
classes.insert(input);
|
classes.insert(input);
|
||||||
joinClass(input.name, input.code)
|
Meteor.call('joinClass',input.name, input.code, function(error,result){});
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user