Commit 8990aa1d authored by Christopher Fullarton's avatar Christopher Fullarton

Fix a bunch of gulp errors

parent ca01f1f0
......@@ -20,7 +20,7 @@
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCamelCaseOrUpperCaseIdentifiers": false,
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
"requireDotNotation": true,
......
......@@ -28,6 +28,8 @@
"console": false,
"closeSplashscreen": true,
"showSplashscreen": true,
"closeAndRedirectTo": true
"closeAndRedirectTo": true,
"Braintree": true,
"BrainTreeConnect": true
}
}
{"_id": "01", "name": "Agricultural and Forestry Sciences", "i18n": { "de": { "name": "Agrar- und Forstwissenschaften"}}}
{"_id": "02", "name": "Information and Telecommunications Technology", "i18n": { "de": { "name": "Informations- und Telekommunikationstechnik"}}}
{"_id": "03", "name": "Engineering Sciences", "i18n": { "de": { "name": "Ingeniuerswissenschaften"}}}
{"_id": "04", "name": "Cultural and Social Sciences", "i18n": { "de": { "name": "Kultur- und Gesellschaftswissenschften"}}}
{"_id": "05", "name": "Art and Music", "i18n": { "de": { "name": "Kunst und Musik"}}}
{"_id": "06", "name": "Mathematics and Natural Sciences", "i18n": { "de": { "name": "Mathematik und Naturwissenschaften"}}}
{"_id": "07", "name": "Media", "i18n": { "de": { "name": "Medien"}}}
{"_id": "08", "name": "Medicine and Health", "i18n": { "de": { "name": "Medizin und Gesundheit"}}}
{"_id": "09", "name": "Education and Teaching", "i18n": { "de": { "name": "Pädagogik und Lehre"}}}
{"_id": "10", "name": "Jurisprudence", "i18n": { "de": { "name": "Rechtswissenschaften"}}}
{"_id": "11", "name": "Foreign Languages and Literatures", "i18n": { "de": { "name": "Sprach- und Literaturwissenschaften"}}}
{"_id": "12", "name": "Social and Behavioral Sciences", "i18n": { "de": { "name": "Sozial- und Verhaltenswissenschaften"}}}
{"_id": "13", "name": "Economics and Management", "i18n": { "de": { "name": "Wirtschaft und Management"}}}
{"_id": "01", "name": "Agricultural and Forestry Sciences", "i18n": {"de": {"name": "Agrar- und Forstwissenschaften"}}}
{"_id": "02", "name": "Information and Telecommunications Technology", "i18n": {"de": {"name": "Informations- und Telekommunikationstechnik"}}}
{"_id": "03", "name": "Engineering Sciences", "i18n": {"de": {"name": "Ingeniuerswissenschaften"}}}
{"_id": "04", "name": "Cultural and Social Sciences", "i18n": {"de": {"name": "Kultur- und Gesellschaftswissenschften"}}}
{"_id": "05", "name": "Art and Music", "i18n": {"de": {"name": "Kunst und Musik"}}}
{"_id": "06", "name": "Mathematics and Natural Sciences", "i18n": {"de": {"name": "Mathematik und Naturwissenschaften"}}}
{"_id": "07", "name": "Media", "i18n": {"de": {"name": "Medien"}}}
{"_id": "08", "name": "Medicine and Health", "i18n": {"de": {"name": "Medizin und Gesundheit"}}}
{"_id": "09", "name": "Education and Teaching", "i18n": {"de": {"name": "Pädagogik und Lehre"}}}
{"_id": "10", "name": "Jurisprudence", "i18n": {"de": {"name": "Rechtswissenschaften"}}}
{"_id": "11", "name": "Foreign Languages and Literatures", "i18n": {"de": {"name": "Sprach- und Literaturwissenschaften"}}}
{"_id": "12", "name": "Social and Behavioral Sciences", "i18n": {"de": {"name": "Sozial- und Verhaltenswissenschaften"}}}
{"_id": "13", "name": "Economics and Management", "i18n": {"de": {"name": "Wirtschaft und Management"}}}
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import {Meteor } from 'meteor/meteor';
import {Mongo } from 'meteor/mongo';
import { Cardsets } from './cardsets.js';
import {Cardsets } from './cardsets.js';
if (Meteor.isServer) {
Meteor.publish("allUsers", function () {
if(Roles.userIsInRole(this.userId, ['admin', 'editor'])) {
return Meteor.users.find({});
}
});
Meteor.publish("allUsers", function () {
if (Roles.userIsInRole(this.userId, [
'admin',
'editor'
])) {
return Meteor.users.find({});
}
});
}
Meteor.methods({
updateUser: function(user_id, visible, email, blockedtext) {
if (!Roles.userIsInRole(this.userId, ['admin', 'editor'])) {
throw new Meteor.Error("not-authorized");
}
updateUser: function (user_id, visible, email, blockedtext) {
if (!Roles.userIsInRole(this.userId, [
'admin',
'editor'
])) {
throw new Meteor.Error("not-authorized");
}
Meteor.users.update(user_id, {
$set: {
visible: visible,
email: email,
blockedtext: blockedtext
}
});
},
deleteUser: function(user_id) {
if (!Roles.userIsInRole(this.userId, ['admin', 'editor'])) {
throw new Meteor.Error("not-authorized");
}
Meteor.users.update(user_id, {
$set: {
visible: visible,
email: email,
blockedtext: blockedtext
}
});
},
deleteUser: function (user_id) {
if (!Roles.userIsInRole(this.userId, [
'admin',
'editor'
])) {
throw new Meteor.Error("not-authorized");
}
Cardsets.update({ owner: user_id }, {
$set: {
userDeleted: true
}
}, {multi:true});
Meteor.users.remove(user_id);
},
updateRoles: function(user_id, newRole) {
if (!Roles.userIsInRole(this.userId, ['admin', 'editor'])) {
throw new Meteor.Error("not-authorized");
}
Cardsets.update({owner: user_id}, {
$set: {
userDeleted: true
}
}, {multi: true});
Meteor.users.remove(user_id);
},
updateRoles: function (user_id, newRole) {
if (!Roles.userIsInRole(this.userId, [
'admin',
'editor'
])) {
throw new Meteor.Error("not-authorized");
}
var roles;
var roles;
if (newRole === 'pro' && !Roles.userIsInRole(user_id, 'pro')) {
Roles.removeUsersFromRoles(user_id, 'standard'),
roles = Roles.getRolesForUser(user_id);
roles.push('pro');
} else if (newRole === 'standard' && !Roles.userIsInRole(user_id, 'standard')) {
Roles.removeUsersFromRoles(user_id, 'pro'),
roles = Roles.getRolesForUser(user_id);
roles.push('standard');
} else if (!Roles.userIsInRole(user_id, newRole)) {
roles = Roles.getRolesForUser(user_id);
roles.push(newRole);
} else {
roles = Roles.getRolesForUser(user_id);
}
if (newRole === 'pro' && !Roles.userIsInRole(user_id, 'pro')) {
Roles.removeUsersFromRoles(user_id, 'standard'), roles = Roles.getRolesForUser(user_id);
roles.push('pro');
} else if (newRole === 'standard' && !Roles.userIsInRole(user_id, 'standard')) {
Roles.removeUsersFromRoles(user_id, 'pro'), roles = Roles.getRolesForUser(user_id);
roles.push('standard');
} else if (!Roles.userIsInRole(user_id, newRole)) {
roles = Roles.getRolesForUser(user_id);
roles.push(newRole);
} else {
roles = Roles.getRolesForUser(user_id);
}
Roles.setUserRoles(user_id, roles);
},
Roles.setUserRoles(user_id, roles);
},
removeRoles: function(user_id, removeRole) {
if (!Roles.userIsInRole(this.userId, ['admin', 'editor'])) {
throw new Meteor.Error("not-authorized");
}
removeRoles: function (user_id, removeRole) {
if (!Roles.userIsInRole(this.userId, [
'admin',
'editor'
])) {
throw new Meteor.Error("not-authorized");
}
if (Roles.userIsInRole(user_id, removeRole)) {
Roles.removeUsersFromRoles(user_id, removeRole);
}
}
if (Roles.userIsInRole(user_id, removeRole)) {
Roles.removeUsersFromRoles(user_id, removeRole);
}
}
});
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import {Meteor } from 'meteor/meteor';
import {Mongo } from 'meteor/mongo';
export const Badges = new TAPi18n.Collection("badges");
if (Meteor.isServer) {
Meteor.publish("badges", function() {
return Badges.find();
});
Meteor.publish("badges", function () {
return Badges.find();
});
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import {Meteor } from 'meteor/meteor';
import {Mongo } from 'meteor/mongo';
export const Categories = new TAPi18n.Collection("categories");
if (Meteor.isServer) {
Meteor.publish("categories", function() {
return Categories.find();
});
Meteor.publish("categories", function () {
return Categories.find();
});
}
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import {Meteor } from 'meteor/meteor';
import {Mongo } from 'meteor/mongo';
export const Experience = new Mongo.Collection("experience");
if (Meteor.isServer) {
Meteor.publish("experience", function() {
if (this.userId && !Roles.userIsInRole(this.userId, 'blocked')) {
return Experience.find({
$or: [
{owner: this.userId},
{owner: {$in: Meteor.users.find({visible: true}).map(function(user) {return user._id})}}
]
});
}
});
Meteor.publish("experience", function () {
if (this.userId && !Roles.userIsInRole(this.userId, 'blocked')) {
return Experience.find({
$or: [
{owner: this.userId},
{owner: {$in: Meteor.users.find({visible: true}).map(function (user) {return user._id})}}
]
});
}
});
}
Meteor.methods({
checkLvl: function() {
var pts = 0;
var points = 0;
var output = 0;
var lvl = 1;
checkLvl: function () {
var pts = 0;
var points = 0;
var output = 0;
var lvl = 1;
var allXp = Experience.find({
owner: Meteor.userId()
});
allXp.forEach(function(xp) {
pts = pts + xp.value;
});
while (pts > output) {
points += Math.floor(lvl + 30 * Math.pow(2, lvl / 10));
output = Math.floor(points / 4);
if (pts >= output) {
lvl++;
}
}
Meteor.users.update(Meteor.userId(), {
$set: {
lvl: lvl
}
});
},
addExperience: function(type, value) {
Experience.insert({
type: type,
value: value,
date: new Date(),
owner: Meteor.userId()
});
Meteor.call('checkLvl');
}
var allXp = Experience.find({
owner: Meteor.userId()
});
allXp.forEach(function (xp) {
pts = pts + xp.value;
});
while (pts > output) {
points += Math.floor(lvl + 30 * Math.pow(2, lvl / 10));
output = Math.floor(points / 4);
if (pts >= output) {
lvl++;
}
}
Meteor.users.update(Meteor.userId(), {
$set: {
lvl: lvl
}
});
},
addExperience: function (type, value) {
Experience.insert({
type: type,
value: value,
date: new Date(),
owner: Meteor.userId()
});
Meteor.call('checkLvl');
}
});
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import {Meteor } from 'meteor/meteor';
import {Mongo } from 'meteor/mongo';
import { Cardsets } from './cardsets.js';
import {Cardsets } from './cardsets.js';
export const Learned = new Mongo.Collection("learned");
if (Meteor.isServer) {
Meteor.publish("learned", function() {
if (this.userId && !Roles.userIsInRole(this.userId, 'blocked')) {
var cardsetsIds = Cardsets.find({
owner: this.userId
}).map(function (cardset) {return cardset._id; });
Meteor.publish("learned", function () {
if (this.userId && !Roles.userIsInRole(this.userId, 'blocked')) {
var cardsetsIds = Cardsets.find({
owner: this.userId
}).map(function (cardset) {
return cardset._id;
});
var learned = Learned.find({
$or: [{user_id: this.userId},{cardset_id: {$in: cardsetsIds}}]
});
return learned;
}
});
var learned = Learned.find({
$or: [
{user_id: this.userId},
{cardset_id: {$in: cardsetsIds}}
]
});
return learned;
}
});
}
Meteor.methods({
addLearned: function(cardset_id, card_id) {
// Make sure the user is logged in
if (!Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
throw new Meteor.Error("not-authorized");
}
Learned.upsert({
cardset_id: cardset_id,
card_id: card_id,
user_id: Meteor.userId()
}, {
$set: {
cardset_id: cardset_id,
card_id: card_id,
user_id: Meteor.userId()
},
$setOnInsert: {
box: 1,
ef: 2.5,
reps: 0,
interval: 0,
nextDate: new Date(),
currentDate: new Date()
}
});
},
updateLearned: function(learned_id, box) {
// Make sure the user is logged in
if (!Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
throw new Meteor.Error("not-authorized");
}
Learned.update(learned_id, {
$set: {
box: box,
currentDate: new Date()
}
});
},
updateLearnedMemo: function(learned_id, grade) {
// Make sure the user is logged in
if (!Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
throw new Meteor.Error("not-authorized");
}
addLearned: function (cardset_id, card_id) {
// Make sure the user is logged in
if (!Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
throw new Meteor.Error("not-authorized");
}
Learned.upsert({
cardset_id: cardset_id,
card_id: card_id,
user_id: Meteor.userId()
}, {
$set: {
cardset_id: cardset_id,
card_id: card_id,
user_id: Meteor.userId()
},
$setOnInsert: {
box: 1,
ef: 2.5,
reps: 0,
interval: 0,
nextDate: new Date(),
currentDate: new Date()
}
});
},
updateLearned: function (learned_id, box) {
// Make sure the user is logged in
if (!Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
throw new Meteor.Error("not-authorized");
}
Learned.update(learned_id, {
$set: {
box: box,
currentDate: new Date()
}
});
},
updateLearnedMemo: function (learned_id, grade) {
// Make sure the user is logged in
if (!Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
throw new Meteor.Error("not-authorized");
}
// EF (easiness factor) is a rating for how difficult the card is.
// Grade: (0-2) Set reps and interval to 0, keep current EF (repeat card today)
// (3) Set interval to 0, lower the EF, reps + 1 (repeat card today)
// (4-5) Reps + 1, interval is calculated using EF, increasing in time.
// EF (easiness factor) is a rating for how difficult the card is.
// Grade: (0-2) Set reps and interval to 0, keep current EF (repeat card today)
// (3) Set interval to 0, lower the EF, reps + 1 (repeat card today)
// (4-5) Reps + 1, interval is calculated using EF, increasing in time.
var learned = Learned.findOne(learned_id),
ef = learned.ef,
reps = learned.reps,
nextDate = new Date();
var learned = Learned.findOne(learned_id), ef = learned.ef, reps = learned.reps, nextDate = new Date();
if (grade < 3) {
reps = 0;
interval = 0;
} else {
ef = ef + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02));
if (ef < 1.3) {
ef = 1.3;
}
reps = reps + 1;
if (grade === 3) {
interval = 0;
} else {
switch (reps) {
case 1:
interval = 1;
break;
case 2:
interval = 6;
break;
default:
interval = Math.ceil((reps - 1) * ef);
break;
}
nextDate.setDate(nextDate.getDate() + interval);
}
}
if (grade < 3) {
reps = 0;
interval = 0;
} else {
ef = ef + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02));
if (ef < 1.3) {
ef = 1.3;
}
reps = reps + 1;
var interval = 0;
if (grade === 3) {
interval = 0;
} else {
switch (reps) {
case 1:
interval = 1;
break;
case 2:
interval = 6;
break;
default:
interval = Math.ceil((reps - 1) * ef);
break;
}
nextDate.setDate(nextDate.getDate() + interval);
}
}
Learned.update(learned_id, {
$set: {
ef: ef,
reps: reps,
interval: interval,
nextDate: nextDate
}
});
}
Learned.update(learned_id, {
$set: {
ef: ef,
reps: reps,
interval: interval,
nextDate: nextDate
}
});
}
});
import { check } from 'meteor/check';
import {check } from 'meteor/check';
Meteor.methods({
convertMarkdown: function(markdown) {
check(markdown, String);
kramed.setOptions({
gfm: true,
tables: true,
breaks: true,
katex: true,
highlight: function(code) {
return hljs.highlightAuto(code).value;
}
});
return kramed(markdown);
}
convertMarkdown: function (markdown) {
check(markdown, String);
kramed.setOptions({
gfm: true,
tables: true,
breaks: true,
katex: true,
highlight: function (code) {
return hljs.highlightAuto(code).value;
}
});
return kramed(markdown);
}
});
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import {Meteor } from 'meteor/meteor';
import {Mongo } from 'meteor/mongo';
export const Notifications = new Mongo.Collection("notifications");
if (Meteor.isServer) {
Meteor.publish("notifications", function() {
if (this.userId && !Roles.userIsInRole(this.userId, 'blocked')) {
return Notifications.find({target: this.userId});
}
});
Meteor.publish("notifications", function () {
if (this.userId && !Roles.userIsInRole(this.userId, 'blocked')) {
return Notifications.find({target: this.userId});
}
});
var NotificationSchema = new SimpleSchema({
target: {
type: String
},
origin: {
type: String
},
type: {
type: String
},
text: {
type: String
},
date: {
type: Date
},
read: {
type: Boolean
},
cleared: {
type: Boolean
},
link_id: {
type: String
},
target_type: {
type: String
},
receiver: {
type: String
}
});
var NotificationSchema = new SimpleSchema({
target: {
type: String
},
origin: {
type: String
},
type: {
type: String
},
text: {
type: String
},
date: {
type: Date
},
read: {
type: Boolean
},
cleared: {
type: Boolean
},
link_id: {
type: String
},
target_type: {
type: String
},
receiver: {
type: String
}
});
Notifications.attachSchema(NotificationSchema);
Notifications.attachSchema(NotificationSchema);
}
Meteor.methods({
addNotification: function(target, type, text, link_id, receiver) {
// Make sure the user is logged in
if (!Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
throw new Meteor.Error("not-authorized");
}
if (target === 'lecturer') {