formattted changes with gulp

parent 9ff51b46
{
"disallowKeywords": ["with"],
"disallowKeywordsOnNewLine": ["else"],
"disallowKeywords": [
"with"
],
"disallowKeywordsOnNewLine": [
"else"
],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineStrings": true,
"disallowPaddingNewlinesInBlocks": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"disallowSpaceAfterPrefixUnaryOperators": [
"++",
"--",
"+",
"-",
"~",
"!"
],
"disallowSpaceBeforeBinaryOperators": [
","
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
......@@ -26,10 +42,24 @@
"requireDotNotation": true,
"requireLineFeedAtFileEnd": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpaceBeforeKeywords": ["else", "while", "catch"],
"requireSpaceBeforeKeywords": [
"else",
"while",
"catch"
],
"requireSpaceBeforeObjectValues": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
......@@ -45,5 +75,5 @@
},
"validateIndentation": "\t",
"validateLineBreaks": "LF",
"maxErrors": Infinity
"maxErrors": Infinity
}
{"_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"
}
}
}
......@@ -216,16 +216,14 @@
"nameAlreadyExists": "Benutzername ist bereits vergeben!"
},
"panel-heading-experience": {
"experience": "Erfahrungspunkte (XP)",
"intervall": "Einstellungen der Intervalle für den Lernzeitraum (XP)",
"preview": "Vorschau"
"experience": "Erfahrungspunkte (XP)",
"intervall": "Einstellungen der Intervalle für den Lernzeitraum (XP)",
"preview": "Vorschau"
},
"panel-body-experience": {
"intervall1" : "Intervall 1",
"intervall2" : "Intervall 2",
"intervall3" : "Intervall 3",
"intervall1": "Intervall 1",
"intervall2": "Intervall 2",
"intervall3": "Intervall 3",
"total": "Total",
"twoDaysAgo": "Vorgestern",
"today": "Heute",
......@@ -233,10 +231,10 @@
"yesterday": "Gestern",
"month": "Wochen",
"threemonth": "Monate",
"default1" : "Standard 7 Tage",
"default2" : "Standard 30 Tage",
"default3" : "Standard 90 Tage",
"reset" : "Zurücksetzen",
"default1": "Standard 7 Tage",
"default2": "Standard 30 Tage",
"default3": "Standard 90 Tage",
"reset": "Zurücksetzen",
"lastredeem": "Zuletzt für: "
},
"panel-body-last": {
......
......@@ -217,22 +217,20 @@
"nameAlreadyExists": "Username is already taken!"
},
"panel-heading-experience": {
"experience": "Experience Points (XP)",
"intervall": "Set the learning period",
"preview": "Preview"
"experience": "Experience Points (XP)",
"intervall": "Set the learning period",
"preview": "Preview"
},
"panel-body-experience": {
"total": "Total",
"today": "Today",
"yesterday": "Yesterday",
"twoDaysAgo": "Two days ago",
"days": "days",
"reset" : "reset",
"default1" : "default 7 days",
"default2" : "default 30 days",
"default3" : "default 90 days",
"reset": "reset",
"default1": "default 7 days",
"default2": "default 30 days",
"default3": "default 90 days",
"lastredeem": "At last for: "
},
"panel-body-last": {
......
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import {Meteor} from 'meteor/meteor';
import {Mongo} from 'meteor/mongo';
export const AdminSettings = new Mongo.Collection("adminSettings");
if (Meteor.isServer) {
Meteor.publish("adminSettings", function() {
return AdminSettings.find();
});
Meteor.publish("adminSettings", function () {
return AdminSettings.find();
});
}
Meteor.methods({
updateIntervall: function (inv1, inv2, inv3) {
if (!Roles.userIsInRole(this.userId, ["admin", "editor"])) {
throw new Meteor.Error("not-authorized");
}
AdminSettings.update(
{
name: "seqSettings"
},
{
$set: {
seqOne: inv1,
seqTwo: inv2,
seqThree: inv3
}
});
}
updateIntervall: function (inv1, inv2, inv3) {
if (!Roles.userIsInRole(this.userId, ["admin", "editor"])) {
throw new Meteor.Error("not-authorized");
}
AdminSettings.update(
{
name: "seqSettings"
},
{
$set: {
seqOne: inv1,
seqTwo: inv2,
seqThree: inv3
}
});
}
});
\ No newline at end of file
......@@ -38,7 +38,7 @@ Meteor.methods({
btGetPaymentMethod: function () {
var btPayment = new Future();
var user = Meteor.users.findOne(this.userId);
var user = Meteor.users.findOne(this.userId);
Meteor.call('btFindCustomer', user.customerId, function (error, customer) {
if (error) {
btPayment.return(error);
......@@ -81,7 +81,7 @@ Meteor.methods({
},
btCreateTransaction: function (nonceFromTheClient, cardset_id) {
var cardset = Cardsets.findOne(cardset_id);
var cardset = Cardsets.findOne(cardset_id);
var btCreateTransaction = new Future();
// Create our customer.
Meteor.call('btCreateCustomer', nonceFromTheClient, function (error, btCustomer) {
......@@ -117,7 +117,7 @@ Meteor.methods({
},
btCreateCredit: function (nonceFromTheClient) {
var user = Meteor.users.findOne(this.userId);
var user = Meteor.users.findOne(this.userId);
var btCreateCredit = new Future();
// Create our customer.
Meteor.call('btCreateCustomer', nonceFromTheClient, function (error, btCustomer) {
......@@ -223,7 +223,7 @@ Meteor.methods({
email: user.email,
paymentMethodNonce: nonce
};
var btCustomer = new Future();
var btCustomer = new Future();
// Calling the Braintree API to create our customer!
gateway.customer.create(customerData, function (error, result) {
if (error) {
......@@ -295,7 +295,7 @@ Meteor.methods({
} else {
// get customer's last subscription
var subscriptionId = result.paymentMethods[0].subscriptions;
var last = subscriptionId.slice(-1)[0];
var last = subscriptionId.slice(-1)[0];
btUserSubscription.return(last);
}
......@@ -307,7 +307,7 @@ Meteor.methods({
btCancelSubscription: function () {
var btCancelSubscription = new Future();
var user = Meteor.userId();
var user = Meteor.userId();
var getUser = Meteor.users.findOne({
"_id": user
}, {
......
......@@ -135,7 +135,7 @@ Meteor.methods({
Meteor.call('checkLvl');
},
deleteCard: function (card_id) {
var card = Cards.findOne(card_id);
var card = Cards.findOne(card_id);
var cardset = Cardsets.findOne(card.cardset_id);
if (!Meteor.userId() || cardset.owner !== Meteor.userId() || Roles.userIsInRole(this.userId, 'blocked')) {
......@@ -188,7 +188,7 @@ Meteor.methods({
}
},
updateCard: function (card_id, front, back) {
var card = Cards.findOne(card_id);
var card = Cards.findOne(card_id);
var cardset = Cardsets.findOne(card.cardset_id);
if (!Roles.userIsInRole(this.userId, [
......
......@@ -112,7 +112,7 @@ CardsetsIndex = new EasySearch.Index({
// Filter selector
const selector = {};
selector.$and = [
selector.$and = [
defSelector,
{
$or: [
......@@ -208,14 +208,14 @@ Meteor.methods({
var relevance = 0;
var ratings = Ratings.find({cardset_id: cardset_id});
var count = ratings.count();
var count = ratings.count();
if (count !== 0) {
var amount = 0;
ratings.forEach(function (rate) {
amount = amount + rate.rating;
});
var result = (amount / count).toFixed(2);
relevance = Number(result);
relevance = Number(result);
}
var kind = Cardsets.findOne(cardset_id).kind;
......
......@@ -24,10 +24,10 @@ if (Meteor.isServer) {
Meteor.methods({
checkLvl: function () {
var pts = 0;
var pts = 0;
var points = 0;
var output = 0;
var lvl = 1;
var lvl = 1;
var allXp = Experience.find({
owner: Meteor.userId()
......
......@@ -74,11 +74,11 @@ Meteor.methods({
// (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();
var interval = 0;
if (grade < 3) {
reps = 0;
reps = 0;
interval = 0;
} else {
ef = ef + (0.1 - (5 - grade) * (0.08 + (5 - grade) * 0.02));
......
......@@ -26,11 +26,11 @@ Meteor.methods({
try {
// If the string is UTF-8, this will work and not throw an error.
front = decodeURIComponent(encodeURIComponent(item.front));
back = decodeURIComponent(encodeURIComponent(item.back));
back = decodeURIComponent(encodeURIComponent(item.back));
} catch (e) {
// If it isn't, an error will be thrown, and we can assume that we have an ISO string.
front = item.front;
back = item.back;
back = item.back;
}
if (item.front !== "") {
......
......@@ -84,7 +84,7 @@ Meteor.methods({
});
},
checkUsersName: function (name, id) {
name = name.trim();
name = name.trim();
var userExists = Meteor.users.findOne({"profile.name": name});
if (userExists && userExists._id !== id) {
......@@ -146,7 +146,7 @@ Meteor.methods({
},
increaseUsersBalance: function (user_id, lecturer_id, amount) {
if (amount < 10) {
var user_amount = Math.round((amount * 0.7) * 100) / 100;
var user_amount = Math.round((amount * 0.7) * 100) / 100;
var lecturer_amount = Math.round((amount * 0.05) * 100) / 100;
Meteor.users.update(user_id, {$inc: {balance: user_amount}});
......
......@@ -194,18 +194,18 @@ Router.route('/admin/notifications', {
});
Router.route('/admin/intervalls', {
name: 'admin_intervall',
template: 'admin_settings',
layoutTemplate: 'admin_main'
name: 'admin_intervall',
template: 'admin_settings',
layoutTemplate: 'admin_main'
});
var isSignedIn = function() {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('home');
} else {
this.next();
}
var isSignedIn = function () {
if (!(Meteor.user() || Meteor.loggingIn())) {
Router.go('home');
} else {
this.next();
}
};
var goToCreated = function () {
......
import { Meteor } from 'meteor/meteor';
import { Categories } from '../../api/categories.js';
import { Badges } from '../../api/badges.js';
import { AdminSettings } from '../../api/adminSettings';
import {Meteor} from 'meteor/meteor';
import {Categories} from '../../api/categories.js';
import {Badges} from '../../api/badges.js';
import {AdminSettings} from '../../api/adminSettings';
Meteor.startup(function() {
var categories = initCategories();
var badges = initBadges();
Meteor.startup(function () {
var categories = initCategories();
var badges = initBadges();
if(!AdminSettings.findOne({name: "seqSettings"})){
AdminSettings.insert({
name: "seqSettings",
seqOne:7,
seqTwo: 30,
seqThree: 90
});
}
if (Categories.find().count() === 0) {
for (var category in categories) {
if (categories.hasOwnProperty(category)) {
Categories.insert(categories[category]);
}
}
}
if (Badges.find().count() === 0) {
for (var badge in badges) {
if (badges.hasOwnProperty(badge)) {
Badges.insert(badges[badge]);
}
}
}
if (!AdminSettings.findOne({name: "seqSettings"})) {
AdminSettings.insert({
name: "seqSettings",
seqOne: 7,
seqTwo: 30,
seqThree: 90
});
}
if (Categories.find().count() === 0) {
for (var category in categories) {
if (categories.hasOwnProperty(category)) {
Categories.insert(categories[category]);
}
}
}
if (Badges.find().count() === 0) {
for (var badge in badges) {
if (badges.hasOwnProperty(badge)) {
Badges.insert(badges[badge]);
}
}
}
});
var initCategories = function() {
var categoryNames = [
"Agricultural and Forestry Sciences",//1
"Information and Telecommunications Technology",//2
"Engineering Sciences",//3
"Cultural and Social Sciences",//4
"Art and Music",//5
"Mathematics and Natural Sciences",//6
"Media",//7
"Medicine and Health",//8
"Education and Teaching",//9
"Jurisprudence",//10
"Foreign Languages and Literatures",//11
"Social and Behavioral Sciences",//12
"Economics and Management"//13
];
var initCategories = function () {
var categoryNames = [
"Agricultural and Forestry Sciences",//1
"Information and Telecommunications Technology",//2
"Engineering Sciences",//3
"Cultural and Social Sciences",//4
"Art and Music",//5
"Mathematics and Natural Sciences",//6
"Media",//7
"Medicine and Health",//8
"Education and Teaching",//9
"Jurisprudence",//10
"Foreign Languages and Literatures",//11
"Social and Behavioral Sciences",//12
"Economics and Management"//13
];
var categoryI18n = [
{//1
"de": {
"name": "Agrar- und Forstwissenschaften"
}
},
{//2
"de": {
"name": "Informations- und Telekommunikationstechnik"
}
},
{//3
"de": {
"name": "Ingeniuerswissenschaften"
}
},
{//4
"de": {
"name": "Kultur- und Gesellschaftswissenschften"
}
},
{//5
"de": {
"name": "Kunst und Musik"
}
},
{//6
"de": {
"name": "Mathematik und Naturwissenschaften"
}
},
{//7
"de": {
"name": "Medien"
}
},
{//8
"de": {
"name": "Medizin und Gesundheit"
}
},
{//9
"de": {
"name": "Pädagogik und Lehre"
}
},
{//10
"de": {
"name": "Rechtswissenschaften"
}
},
{//11
"de": {
"name": "Sprach- und Literaturwissenschaften"
}
},
{//12
"de": {
"name": "Sozial- und Verhaltenswissenschaften"
}
},
{//13
"de": {
"name": "Wirtschaft und Management"
}
}
];
var categoryI18n = [
{//1
"de": {
"name": "Agrar- und Forstwissenschaften"
}
},
{//2
"de": {
"name": "Informations- und Telekommunikationstechnik"
}
},
{//3
"de": {
"name": "Ingeniuerswissenschaften"
}
},
{//4
"de": {
"name": "Kultur- und Gesellschaftswissenschften"
}
},
{//5
"de": {
"name": "Kunst und Musik"
}
},
{//6
"de": {
"name": "Mathematik und Naturwissenschaften"
}
},
{//7
"de": {
"name": "Medien"
}
},
{//8
"de": {