Commit ecd72e7a authored by Curtis Adam's avatar Curtis Adam

Revert "Allow the use of card sets with active bonus phase without joining them"

This reverts commit 42e433c6296e4200699f10b05c0e1d9d44472a93
parent f7b2a70b
......@@ -520,28 +520,6 @@
"selectShuffledCardsetToLearn": "Mit einem Klick auf das Thema eines Repetitoriums nimmst du es in dein Lernpensum auf."
},
"bonus": {
"info": {
"button": {
"join": "Bonus-Lernphase beitreten",
"leave": "Bonus-Lernphase verlassen"
}
},
"form-join": {
"title": "Bonus-Lernphase beitreten",
"message": "Möchtest du der aktiven Bonus-Lernphase beitreten? Beim Beitritt wird dein derzeitiger Leitner und Wozniak Lernstand zurückgesetzt.",
"button": {
"confirm": "Beitreten",
"cancel": "Abbrechen"
}
},
"form-leave": {
"title": "Bonus-Lernphase verlassen",
"message": "Beim Verlassen einer aktiven Bonusphase wird dein derzeitiger Lernfortschritt gelöscht. Der Dozent kann dadurch diesen nicht mehr für die Bonusvergabe verwenden.",
"button": {
"confirm": "Verlassen",
"cancel": "Abbrechen"
}
},
"message": {
"registrationPeriodExpired": "Die Anmeldefrist ist abgelaufen. Du kannst der Bonusphase nicht mehr beitreten.",
"bonusEnded": "Die Bonus-Lernphase ist zuende",
......
......@@ -543,28 +543,6 @@
"selectShuffledCardsetToLearn": "Add shuffled cardset to Workload"
},
"bonus": {
"info": {
"button": {
"join": "Join Bonus",
"leave": "Leave Bonus"
}
},
"form-join": {
"title": "Join Bonus",
"message": "",
"button": {
"confirm": "Join",
"cancel": "Cancel"
}
},
"form-leave": {
"title": "Leave Bonus",
"message": "",
"button": {
"confirm": "Leave",
"cancel": "Cancel"
}
},
"message": {
"registrationPeriodExpired": "",
"bonusEnded": "",
......
import {Cardsets} from "./cardsets";
import {Meteor} from "meteor/meteor";
import {Workload} from "./learned";
export let Bonus = class Bonus {
static isInBonus (cardset_id, user_id = undefined) {
if (user_id === undefined) {
user_id = Meteor.userId();
}
let workload = Workload.findOne({user_id: user_id, cardset_id: cardset_id}, {fields: {'leitner.bonus': 1}});
if (workload !== undefined && workload.leitner !== undefined && workload.leitner.bonus !== undefined) {
return workload.leitner.bonus === true;
} else {
return false;
}
}
static canJoinBonus (cardset_id) {
let cardset = Cardsets.findOne({_id: cardset_id}, {fields: {_id: 1, registrationPeriod: 1, owner: 1}});
if (Roles.userIsInRole(Meteor.userId(), ['firstLogin', 'blocked']) || cardset.owner === Meteor.userId()) {
return false;
}
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'editor', 'lecturer', 'university', 'pro'])) {
return !this.isInBonus(cardset._id) && cardset.registrationPeriod > new Date();
} else {
return false;
}
}
};
import {Meteor} from "meteor/meteor";
import {Leitner, Workload} from "./learned.js";
import {Leitner} from "./learned.js";
import {Cardsets} from "./cardsets.js";
import {check} from "meteor/check";
import {getAuthorName} from "./userdata";
......@@ -58,14 +58,17 @@ function sortByBirthname(data) {
function getLearners(data, cardset_id) {
let learningDataArray = [];
for (let i = 0; i < data.length; i++) {
let user = Meteor.users.find({_id: data[i].user_id}).fetch();
let distinctData = _.uniq(data, false, function (d) {
return d.user_id;
});
for (let i = 0; i < distinctData.length; i++) {
let user = Meteor.users.find({_id: distinctData[i].user_id}).fetch();
let filter = [];
for (let l = 1; l < 6; l++) {
filter.push({
cardset_id: cardset_id,
user_id: data[i].user_id,
user_id: distinctData[i].user_id,
box: l
});
}
......@@ -108,7 +111,7 @@ Meteor.methods({
content += header[i] + " [" + cardset.learningInterval[i] + "]" + colSep;
}
content += header[5] + colSep + colSep + cardsetInfo[infoCardsetCounter++][0] + newLine;
let learners = getLearners(Workload.find({cardset_id: cardset_id, 'leitner.bonus': true}).fetch(), cardset_id);
let learners = getLearners(Leitner.find({cardset_id: cardset_id}).fetch(), cardset_id);
for (let k = 0; k < learners.length; k++) {
content += learners[k].birthname + colSep + learners[k].givenname + colSep + learners[k].email + colSep;
content += learners[k].box1 + colSep + learners[k].box2 + colSep + learners[k].box3 + colSep + learners[k].box4 + colSep + learners[k].box5 + colSep + learners[k].box6 + colSep;
......@@ -132,7 +135,7 @@ Meteor.methods({
check(cardset_id, String);
let cardset = Cardsets.findOne({_id: cardset_id});
if (Roles.userIsInRole(Meteor.userId(), ["admin", "editor"]) || (Meteor.userId() === cardset.owner || cardset.editors.includes(Meteor.userId()))) {
return getLearners(Workload.find({cardset_id: cardset_id, 'leitner.bonus': true}).fetch(), cardset_id);
return getLearners(Leitner.find({cardset_id: cardset_id}).fetch(), cardset_id);
}
},
getEditors: function (cardset_id) {
......
......@@ -2,7 +2,7 @@ import {Meteor} from "meteor/meteor";
import {Mongo} from "meteor/mongo";
import {SimpleSchema} from "meteor/aldeed:simple-schema";
import {Cards} from "./cards.js";
import {Leitner, Workload, Wozniak} from "./learned.js";
import {Leitner, Wozniak} from "./learned.js";
import {Notifications} from "./notifications.js";
import {Ratings} from "./ratings.js";
import {check} from "meteor/check";
......@@ -411,27 +411,7 @@ Meteor.methods({
learningActive: false
}
});
let users = Workload.find({cardset_id: cardset._id, 'leitner.bonus': true}, {fields: {user_id: 1}}).fetch();
for (let i = 0; i < users.length; i++) {
Workload.update({
cardset_id: cardset._id,
user_id: users[i].user_id
},
{
$set: {
'leitner.bonus': false
}
}
);
Leitner.remove({
cardset_id: cardset._id,
user_id: users[i].user_id
});
Wozniak.remove({
cardset_id: cardset._id,
user_id: users[i].user_id
});
}
Meteor.call("clearLeitnerProgress", id);
} else {
throw new Meteor.Error("not-authorized");
}
......@@ -473,6 +453,8 @@ Meteor.methods({
registrationPeriod: registrationPeriod
}
});
Meteor.call("clearLeitnerProgress", id);
Meteor.call("activateLearningPeriodSetEdu", id);
} else {
throw new Meteor.Error("not-authorized");
}
......@@ -640,6 +622,22 @@ Meteor.methods({
}
}
},
activateLearningPeriodSetEdu: function (cardset_id) {
check(cardset_id, String);
if (!Roles.userIsInRole(this.userId, ["admin", "editor", "lecturer"])) {
throw new Meteor.Error("not-authorized");
}
Cardsets.update({
_id: cardset_id
}, {
$set: {
kind: "edu"
}
}, {
multi: true
});
},
updateRelevance: function (cardset_id) {
check(cardset_id, String);
......
......@@ -6,36 +6,9 @@ import {check} from "meteor/check";
export const Learned = new Mongo.Collection("learned");
export const Leitner = new Mongo.Collection("leitner");
export const Wozniak = new Mongo.Collection("wozniak");
export const Workload = new Mongo.Collection("workload");
if (Meteor.isServer) {
Meteor.publish("cardsetWorkload", function (cardset_id) {
if (this.userId) {
if (Roles.userIsInRole(this.userId, [
'admin',
'editor',
'lecturer'
])) {
return Workload.find({
cardset_id: cardset_id,
$or: [
{user_id: this.userId},
{'leitner.bonus': true}
]
});
} else {
return Workload.find({
cardset_id: cardset_id,
user_id: this.userId
});
}
}
});
Meteor.publish("userWorkload", function () {
if (this.userId) {
return Workload.find({user_id: this.userId});
}
});
Meteor.publish("cardsetLeitner", function (cardset_id) {
if (this.userId) {
return Leitner.find({cardset_id: cardset_id, user_id: this.userId});
......@@ -79,6 +52,15 @@ if (Meteor.isServer) {
});
Meteor.methods({
clearLeitnerProgress: function (cardset_id) {
check(cardset_id, String);
if (!Roles.userIsInRole(this.userId, ["admin", "editor", "lecturer"])) {
throw new Meteor.Error("not-authorized");
}
Leitner.remove({cardset_id: cardset_id});
Meteor.call("updateLearnerCount", cardset_id);
},
/** Function marks an active leitner card as learned
* @param {string} cardset_id - The cardset id from the card
* @param {string} card_id - The id from the card
......@@ -132,10 +114,11 @@ if (Meteor.isServer) {
if (!Meteor.userId() || Roles.userIsInRole(this.userId, ["firstLogin", "blocked"])) {
throw new Meteor.Error("not-authorized");
}
Leitner.remove({
cardset_id: cardset_id,
user_id: Meteor.userId()
});
}, {multi: true});
Meteor.call("updateLearnerCount", cardset_id);
return true;
},
......@@ -149,7 +132,7 @@ if (Meteor.isServer) {
Wozniak.remove({
cardset_id: cardset_id,
user_id: Meteor.userId()
});
}, {multi: true});
Meteor.call("updateLearnerCount", cardset_id);
return true;
},
......
import {Meteor} from "meteor/meteor";
import {Cardsets} from "./cardsets.js";
import {Cards} from "./cards.js";
import {Leitner, Workload, Wozniak} from "./learned.js";
import {Leitner, Wozniak} from "./learned.js";
import {Ratings} from "./ratings.js";
import {check} from "meteor/check";
import {Session} from "meteor/session";
......@@ -403,10 +403,6 @@ Meteor.methods({
user_id: this.userId
});
Workload.remove({
user_id: this.userId
});
Ratings.remove({
user: this.userId
});
......
......@@ -142,7 +142,7 @@ Router.route('/learn', {
template: 'cardsets',
loadingTemplate: 'cardsets',
waitOn: function () {
return [Meteor.subscribe('userWorkload', this.params._id), Meteor.subscribe('userLeitner'), Meteor.subscribe('userWozniak')];
return [Meteor.subscribe('userLeitner'), Meteor.subscribe('userWozniak')];
},
data: function () {
Session.set('helpFilter', "workload");
......@@ -168,7 +168,7 @@ Router.route('/cardset/:_id', {
name: 'cardsetdetailsid',
template: 'cardsetAccess',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
},
data: function () {
MarkdeepEditor.changeMobilePreview(true);
......@@ -182,7 +182,7 @@ Router.route('/cardset/:_id/card/:card_id', {
name: 'cardsetcard',
template: 'cardsetAccess',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
},
data: function () {
MarkdeepEditor.changeMobilePreview(true);
......@@ -215,9 +215,6 @@ Router.route('/cardset/:_id/editors', {
Router.route('/cardset/:_id/stats', {
name: 'cardsetstats',
template: 'cardsetLearnActivityStatistic',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id)];
},
data: function () {
Session.set('helpFilter', "workloadProgress");
return Cardsets.findOne({_id: this.params._id});
......@@ -232,7 +229,7 @@ Router.route('/cardsetlist/:_id', {
name: 'cardsetlistid',
template: 'cardsetAccess',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
},
data: function () {
Session.set('helpFilter', "cardset");
......@@ -245,7 +242,7 @@ Router.route('/cardset/:_id/newcard', {
name: 'newCard',
template: 'newCard',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id)];
},
data: function () {
Session.set('helpFilter', "cardEditor");
......@@ -257,7 +254,7 @@ Router.route('/cardset/:_id/editcard/:card_id', {
name: 'editCard',
template: 'editCard',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id)];
},
data: function () {
Session.set('helpFilter', "cardEditor");
......@@ -277,7 +274,7 @@ Router.route('/progress/:_id/:user_id', {
name: 'progress',
template: 'progress',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('userCardsetLeitner', this.params._id, this.params.user_id)];
return [Meteor.subscribe('userCardsetLeitner', this.params._id, this.params.user_id)];
},
action: function () {
if (this.ready()) {
......@@ -294,7 +291,7 @@ Router.route('/box/:_id', {
name: 'box',
template: 'learnAlgorithmAccess',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetLeitner', this.params._id)];
},
data: function () {
MarkdeepEditor.changeMobilePreview(true);
......@@ -307,7 +304,7 @@ Router.route('/memo/:_id', {
name: 'memo',
template: 'learnAlgorithmAccess',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id), Meteor.subscribe('cardsetWozniak', this.params._id)];
},
data: function () {
MarkdeepEditor.changeMobilePreview(true);
......@@ -320,7 +317,7 @@ Router.route('/presentationlist/:_id', {
name: 'presentationlist',
template: 'presentation',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id)];
},
data: function () {
Session.set('helpFilter', undefined);
......@@ -332,7 +329,7 @@ Router.route('/presentation/:_id', {
name: 'presentation',
template: 'presentation',
subscriptions: function () {
return [Meteor.subscribe('cardsetWorkload', this.params._id), Meteor.subscribe('cardsetCards', this.params._id)];
return [Meteor.subscribe('cardsetCards', this.params._id)];
},
data: function () {
MarkdeepEditor.changeMobilePreview(true);
......
......@@ -2,7 +2,7 @@ import {Meteor} from "meteor/meteor";
import {Cards} from "../../api/cards.js";
import {Cardsets} from "../../api/cardsets.js";
import {ColorThemes} from "../../api/theme.js";
import {Learned, Leitner, Wozniak, Workload} from "../../api/learned.js";
import {Learned, Leitner, Wozniak} from "../../api/learned.js";
import {AdminSettings} from "../../api/adminSettings";
import {CronScheduler} from "../../../server/cronjob.js";
import {Ratings} from "../../api/ratings";
......@@ -610,35 +610,7 @@ Meteor.startup(function () {
);
}
let workload = Workload.find({}).count();
let wozniak;
if (workload === 0) {
let learnerData = [];
cardsets = Cardsets.find({kind: {$in: ["personal", "free", "edu", "pro"]}}, {fields: {_id: 1, learningActive: 1}}).fetch();
for (let i = 0; i < cardsets.length; i++) {
let userData = {};
let usersLeitner = Leitner.find({cardset_id: cardsets[i]._id}, {fields: {user_id: 1, cardset_id: 1}}).fetch();
let users = _.uniq(usersLeitner, false, function (d) {
return d.user_id;
});
for (let k = 0; k < users.length; k++) {
userData = {
cardset_id: cardsets[i]._id,
user_id: users[k].user_id,
leitner: {
bonus: cardsets[i].learningActive,
dateJoinedBonus: new Date()
}
};
learnerData.push(userData);
}
}
if (learnerData.length > 0) {
Workload.batchInsert(learnerData);
}
}
wozniak = Wozniak.find({skipped: {$exists: true}}).fetch();
let wozniak = Wozniak.find({skipped: {$exists: true}}).fetch();
for (let i = 0; i < wozniak.length; i++) {
Wozniak.update({
_id: wozniak[i]._id
......
......@@ -42,15 +42,13 @@
{{> leaveCardsetForm}}
{{> leaveEditorsForm}}
{{> chooseFlashcards}}
{{> joinBonusForm}}
{{> leaveBonusForm}}
{{/unless}}
{{#if hasCardsetPermission}}
{{#unless learningActiveAndEditor}}
{{selectedForLearning}}
{{/unless}}
{{#if isActiveRoute regex='cardsetdetailsid|cardsetcard'}}
{{#unless isInBonus}}
{{#unless learningActiveAndNotEditor}}
{{#if this.quantity}}
<div class="hidden-xs col-xs-12">
{{> cardNavigation}}
......@@ -296,10 +294,10 @@
<div class="cardsetInfoFooter panel-footer">
{{#if hasCardsetPermission}}
{{#if isInBonus}}
{{#if learningActive}}
{{> leitnerLearning}}
{{/if}}
{{#unless isInBonus}}
{{#unless learningActive}}
{{#if this.quantity}}
{{#if gotPresentation}}
<div class="btn-group">
......@@ -456,41 +454,47 @@
{{/if}}
{{/if}}
{{#unless isCardsetOwner _id}}
<div class="hidden-xs btn-group">
<button class="btn btn-sm btn-raised manageBtn" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fa fa-cog"></i> {{_ "manage"}} <span
class="caret"></span>
</button>
<ul class="dropdown-menu">
{{#if enableIfPublished}}
{{#unless isEditor}}
<li id="report_button" class="reportList" data-toggle="modal"
data-target="#reportModal">{{_
"report"}}</li>
{{#unless isInBonus}}
{{#if learning}}
<li id="leaveCardsetModalButton" class="leaveCardsetList"
data-toggle="modal" data-target="#leaveCardsetModal">{{_
"confirm-leave-cardset.btn-txt"}}</li>
{{#if gotAccessToManageButton}}
<div class="hidden-xs btn-group">
<button class="btn btn-sm btn-raised manageBtn" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fa fa-cog"></i> {{_ "manage"}} <span
class="caret"></span>
</button>
<ul class="dropdown-menu">
{{#if enableIfPublished}}
{{#unless isEditor}}
<li id="report_button" class="reportList" data-toggle="modal"
data-target="#reportModal">{{_
"report"}}</li>
{{#if learningActive}}
<li id="leaveLearnPhaseButton" class="leaveLearnPhaseList"
data-toggle="modal" data-target="#leaveModal">{{_
"confirm-leave-learnphase.btn-txt"}}</li>
{{else}}
<li id="leaveCardsetButton" class="leaveCardsetList">{{_
"confirm-leave-cardset.btn-txt"}}</li>
{{#if learning}}
<li id="leaveCardsetModalButton" class="leaveCardsetList"
data-toggle="modal" data-target="#leaveCardsetModal">{{_
"confirm-leave-cardset.btn-txt"}}</li>
{{else}}
<li id="leaveCardsetButton" class="leaveCardsetList">{{_
"confirm-leave-cardset.btn-txt"}}</li>
{{/if}}
{{/if}}
{{/unless}}
{{/unless}}
{{#if isEditor}}
{{#unless isCardsetOwner _id}}
<li id="leaveEditors" class="leaveEditorsList"
data-toggle="modal" data-target="#leaveEditorsModal">{{_
"sidebar-nav.leaveEditors"}}</li>
{{/unless}}
{{#if isEditor}}
{{#unless isCardsetOwner _id}}
<li id="leaveEditors" class="leaveEditorsList"
data-toggle="modal" data-target="#leaveEditorsModal">{{_
"sidebar-nav.leaveEditors"}}</li>
{{/unless}}
{{/if}}
{{/if}}
{{/if}}
</ul>
</div>
</ul>
</div>
{{/if}}
{{/unless}}
{{#unless isInBonus}}
{{#unless learningActive}}
{{#unless isShuffledCardset this._id}}
{{#if this.quantity}}
{{#if isCardsetOwner _id}}
......@@ -1447,24 +1451,6 @@
<td>{{_ "bonus.form.registrationPeriod.label"}}:</td>
<td>{{getRegistrationPeriod}}</td>
</tr>
{{#if canJoinBonus}}
<tr>
<td colspan="2">
<a class="btn btn-raised btn-block btn-success" data-toggle="modal"
data-target="#joinBonusModal">{{_
"bonus.info.button.join"}}</a>
</td>
</tr>
{{/if}}
{{#if isInBonus}}
<tr>
<td colspan="2">
<a class="btn btn-raised btn-block btn-danger" data-toggle="modal"
data-target="#leaveBonusModal">{{_
"bonus.info.button.leave"}}</a>
</td>
</tr>
{{/if}}
</tbody>
</table>
</div>
......
......@@ -22,7 +22,6 @@ import {CardVisuals} from "../../api/cardVisuals";
import {CardsetVisuals} from "../../api/cardsetVisuals";
import ResizeSensor from "../../../client/resize_sensor/ResizeSensor";
import {BertAlertVisuals} from "../../api/bertAlertVisuals";
import {Bonus} from "../../api/bonus";
Meteor.subscribe("cardsets");
Meteor.subscribe("paid");
......@@ -147,9 +146,6 @@ Template.cardset.helpers({
Session.set("selectingCardsetToLearn", false);
BertAlertVisuals.displayBertAlert(TAPi18n.__('cardset.alert.addedToWorkload'), 'success', 'growl-top-left');
}
},
isInBonus: function () {
return Bonus.isInBonus(Session.get('activeCardset')._id, Meteor.userId());
}
});
......@@ -501,7 +497,9 @@ Template.cardsetInfo.helpers({
learningMemo: function () {
return Wozniak.findOne({
cardset_id: Router.current().params._id,
user_id: Meteor.userId()});
user_id: Meteor.userId(),
interval: {$ne: 0}
});
},
learning: function () {
return (Leitner.findOne({
......@@ -516,8 +514,16 @@ Template.cardsetInfo.helpers({
enableIfPublished: function () {
return this.kind !== 'personal';
},
isInBonus: function () {
return Bonus.isInBonus(Session.get('activeCardset')._id, Meteor.userId());
gotAccessToManageButton: function () {
if (Session.get('activeCardset').learningActive) {
let leitnerCount = Leitner.find({cardset_id: Session.get('activeCardset')._id, user_id: Meteor.userId()}).count();
let wozniakCount = Wozniak.find({cardset_id: Session.get('activeCardset')._id, user_id: Meteor.userId()}).count();
if ((leitnerCount + wozniakCount) > 0) {
return true;
}
} else {
return true;
}
}
});
......@@ -1545,7 +1551,7 @@ Template.reportCardsetForm.events({
Template.resetLeitnerForm.events({
"click #resetLeitnerConfirm": function () {
$('#resetLeitnerModal').on('hidden.bs.modal', function () {
Meteor.call("deleteLeitner", Router.current().params._id);
Meteor.call("resetLeitner", Router.current().params._id);
}).modal('hide');
}
});
......@@ -1558,7 +1564,7 @@ Template.resetLeitnerForm.events({
Template.resetMemoForm.events({
"click #resetMemoConfirm": function () {
$('#resetMemoModal').on('hidden.bs.modal', function () {
Meteor.call("deleteWozniak", Router.current().params._id);
Meteor.call("resetWozniak", Router.current().params._id);
}).modal('hide');
}
});
......@@ -1598,12 +1604,6 @@ Template.learningPhaseInfoBox.helpers({
} else {
return this.maxCards + " " + TAPi18n.__('confirmLearn-form.cards');
}
},
canJoinBonus: function () {
return Bonus.canJoinBonus(Session.get('activeCardset')._id);
},
isInBonus: function () {
return Bonus.isInBonus(Session.get('activeCardset')._id);
}
});
......
......@@ -300,16 +300,8 @@ $padding-card-list-row: 8px;
float: none;
}
.infoBoxTable tr {
td:first-child {
padding-left: 15px !important;
}
td:last-child {
padding-right: 15px !important;
}
}
.infoBoxTable td {
padding-left: 15px !important;
@media(max-width: 767px) {
font-size: $font_size_collapse_button_content_mobile !important;
}
......
......@@ -9,7 +9,6 @@ import "./cardsets.html";
import {Filter} from "../../api/filter";
import {Route} from "../../api/route";
import {BertAlertVisuals} from "../../api/bertAlertVisuals";
import {Workload} from "../../api/learned";
Session.setDefault('cardsetId', undefined);
Session.set('moduleActive', true);
......@@ -296,20 +295,11 @@ Template.cardsets.events({
Template.cardsetsConfirmLearnForm.events({
'click #learnDelete': function () {
$('#bonusFormModal').on('hidden.bs.modal', function () {
let workload = Workload.findOne({user_id: Meteor.userId(), cardset_id: Session.get('cardsetId')}, {fields: {_id: 1, 'leitner.bonus': 1}});
if (workload !== undefined && workload.leitner.bonus === true) {
Meteor.call("leaveBonus", Session.get('cardsetId'), function (error, result) {
if (result) {
Filter.updateWorkloadFilter();
}