GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit ccbc365a authored by Curtis Adam's avatar Curtis Adam

Allow users to edit transcripts with an expired deadline

parent 547abf21
......@@ -687,7 +687,7 @@
"percentage": "Maximale Bonuspunkte",
"enable": "Bonus aktivieren",
"lectureTimeEnd": "Freischaltung für Abgabe",
"deadline": "Bearbeitungszeit",
"deadline": "Abgabezeit",
"lectureDates": "Termine für das Bonus-Mitschreiben",
"clock": "Uhr",
"hours": "Stunden",
......
......@@ -689,7 +689,7 @@
"percentage": "Maximale Bonuspunkte",
"enable": "Bonus aktivieren",
"lectureTimeEnd": "Vorlesungsende",
"deadline": "Bearbeitungszeit",
"deadline": "Abgabezeit",
"lectureDates": "Termine der Veranstaltungen",
"clock": "Uhr",
"hours": "Stunden",
......
......@@ -448,11 +448,6 @@ Meteor.methods({
transcriptBonusUser = undefined;
}
let transcriptBonusDatabase = TranscriptBonus.findOne({card_id: card_id});
if (transcriptBonusDatabase !== undefined) {
if (TranscriptBonusList.isDeadlineExpired(transcriptBonusDatabase)) {
throw new Meteor.Error(TAPi18n.__('transcriptForm.server.deadlineExpired', {}, Meteor.user().profile.locale));
}
}
if (card.cardset_id === "-1" && card.owner === Meteor.userId()) {
isOwner = true;
} else {
......
......@@ -100,10 +100,10 @@ export let TranscriptBonusList = class TranscriptBonusList {
static checkForUpdate (card_id, user_id, transcriptBonusUser, transcriptBonusDatabase = undefined, date_id = undefined) {
if (Meteor.isServer) {
if (this.canBeSubmittedToLecture(transcriptBonusUser, date_id)) {
let transcriptBonusCardset = Cardsets.findOne(transcriptBonusUser.cardset_id);
if (transcriptBonusDatabase !== undefined) {
if (transcriptBonusUser.cardset_id !== transcriptBonusDatabase.cardset_id || transcriptBonusUser.date.getTime() !== transcriptBonusDatabase.date.getTime()) {
let transcriptBonusCardset = Cardsets.findOne(transcriptBonusUser.cardset_id);
if (transcriptBonusDatabase !== undefined) {
if (transcriptBonusUser.cardset_id !== transcriptBonusDatabase.cardset_id || transcriptBonusUser.date.getTime() !== transcriptBonusDatabase.date.getTime()) {
if (this.canBeSubmittedToLecture(transcriptBonusUser, date_id)) {
for (let i = 0; i < transcriptBonusCardset.transcriptBonus.dates.length; i++) {
if (transcriptBonusCardset.transcriptBonus.dates[i].getTime() === transcriptBonusUser.date.getTime()) {
date_id = i;
......@@ -115,10 +115,12 @@ export let TranscriptBonusList = class TranscriptBonusList {
} else {
Meteor.call("addTranscriptBonus", card_id, transcriptBonusCardset._id, Meteor.userId(), date_id);
}
} else {
throw new Meteor.Error(TAPi18n.__('transcriptForm.server.notFound', {}, Meteor.user().profile.locale));
}
} else {
Meteor.call("addTranscriptBonus", card_id, transcriptBonusUser.cardset_id, Meteor.userId(), date_id);
}
} else {
Meteor.call("addTranscriptBonus", card_id, transcriptBonusUser.cardset_id, Meteor.userId(), date_id);
}
}
}
......
......@@ -6,6 +6,6 @@
</form>
{{#if gotLearningUnit}}
<button class="btn btn-raised btn-success col-xs-4 col-sm-3 btn subjectEditorButton float-right" data-toggle="modal"
data-target="#showSelectLearningUnitModal">{{_ "transcriptForm.button.modal"}}</button>
data-target="#showSelectLearningUnitModal" {{gotTranscriptBonusThatExpired}}>{{_ "transcriptForm.button.modal"}}</button>
{{/if}}
</template>
import {CardType} from "../../../../api/cardTypes";
import {CardEditor} from "../../../../api/cardEditor.js";
import {Session} from "meteor/session";
import "./subject.html";
import {TranscriptBonusList} from "../../../../api/transcriptBonus";
import "./subject.html";
/*
* ############################################################################
......@@ -29,6 +29,13 @@ Template.subjectEditor.helpers({
} else {
return "";
}
},
gotTranscriptBonusThatExpired: function () {
if (Session.get('transcriptBonus') !== undefined && TranscriptBonusList.isDeadlineExpired(Session.get('transcriptBonus'))) {
return "disabled";
} else {
return "";
}
}
});
......
......@@ -49,12 +49,10 @@
</div>
<div class="resultItemHeaderRightAreaBottom col-xs-6 col-sm-12">
{{#unless isCardsetTranscriptBonusRoute}}
{{#unless isMyBonusTranscriptsRouteAndDeadlineExpired}}
<a class="resultNavigationElement editCard hidden-xs" {{disableIfOffline}}
title='{{_ "transcriptForm.index.tooltip.edit"}}' data-id="{{this._id}}">
<i class="glyphicon glyphicon-edit" data-id="{{this._id}}"></i>
</a>
{{/unless}}
<a class="resultNavigationElement editCard hidden-xs" {{disableIfOffline}}
title='{{_ "transcriptForm.index.tooltip.edit"}}' data-id="{{this._id}}">
<i class="glyphicon glyphicon-edit" data-id="{{this._id}}"></i>
</a>
<a class="resultNavigationElement deleteCard" {{disableIfOffline}}
title='{{_ "transcriptForm.index.tooltip.delete"}}' data-toggle="modal" data-target="#deleteTranscriptModal" data-id="{{this._id}}">
<i class="result fa fa-trash" data-id="{{this._id}}"></i>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment