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

Commit a945a462 authored by Curtis Adam's avatar Curtis Adam

Don't allow transcripts to be rated if the editing didn't expire

parent 3c218af5
......@@ -1225,7 +1225,8 @@
"rate": "Mitschrift bewerten",
"skip": "Überspringen",
"accept": "Akzeptieren",
"deny": "Ablehnen"
"deny": "Ablehnen",
"notUnlocked": "Die digitale Bearbeitungsfrist ist noch nicht abgelaufen"
},
"notification": {
"accept": "Die Mitschrift wurde akzeptiert",
......
......@@ -1227,7 +1227,8 @@
"rate": "Mitschrift bewerten",
"skip": "Überspringen",
"accept": "Akzeptieren",
"deny": "Ablehnen"
"deny": "Ablehnen",
"notUnlocked": "Die digitale Bearbeitungsfrist ist noch nicht abgelaufen"
},
"notification": {
"accept": "Die Mitschrift wurde akzeptiert",
......
......@@ -94,7 +94,7 @@ export let TranscriptBonusList = class TranscriptBonusList {
if (transcriptBonus.lectureEnd !== undefined) {
let deadline = this.addLectureEndTime(transcriptBonus, date_id);
deadline.add(transcriptBonus.deadline, 'hours');
return TAPi18n.__('transcriptForm.deadline.submission') + ": " + Utilities.getMomentsDate(deadline, true, true);
return TAPi18n.__('transcriptForm.deadline.submission') + ": " + Utilities.getMomentsDate(deadline, true, 1);
}
}
......@@ -103,9 +103,9 @@ export let TranscriptBonusList = class TranscriptBonusList {
let deadlineEditing = this.addLectureEndTime(transcriptBonus, date_id);
deadlineEditing.add(transcriptBonus.deadlineEditing, 'hours');
if (reviewMode) {
return Utilities.getMomentsDate(deadlineEditing, true, false);
return Utilities.getMomentsDate(deadlineEditing, true, 2, false);
} else {
return TAPi18n.__('transcriptForm.deadline.editing') + ": " + Utilities.getMomentsDate(deadlineEditing, true, true);
return TAPi18n.__('transcriptForm.deadline.editing') + ": " + Utilities.getMomentsDate(deadlineEditing, true, 1);
}
}
}
......
......@@ -4,7 +4,7 @@ import {CardType} from "./cardTypes";
import {ServerStyle} from "./styles";
export let Utilities = class Utilities {
static getCalendarString (type = '', minutes = '', displayAsDeadline = false) {
static getCalendarString (type = '', minutes = '', displayMode = 0) {
let today = '[Today]';
let yesterday = '[Yesterday]';
let tomorrow = '[Tomorrow]';
......@@ -16,10 +16,16 @@ export let Utilities = class Utilities {
}
if (language === 'de') {
if (minutes !== '') {
if (displayAsDeadline) {
minutes = '[ bis ]' + minutes + '[ Uhr ]';
} else {
minutes = '[ ]' + minutes;
switch (displayMode) {
case 1:
minutes = '[ bis ]' + minutes + '[ Uhr ]';
break;
case 2:
minutes = '[ ab ]' + minutes + '[ Uhr ]';
break;
default:
minutes = '[ ]' + minutes;
break;
}
}
today = '[Heute]';
......@@ -27,10 +33,16 @@ export let Utilities = class Utilities {
tomorrow = '[Morgen]';
} else {
if (minutes !== '') {
if (displayAsDeadline) {
minutes = '[ until ]' + minutes;
} else {
minutes = '[ ]' + minutes;
switch (displayMode) {
case 1:
minutes = '[ until ]' + minutes;
break;
case 2:
minutes = '[ at ]' + minutes;
break;
default:
minutes = '[ ]' + minutes;
break;
}
}
}
......@@ -46,7 +58,7 @@ export let Utilities = class Utilities {
}
}
static getMomentsDate (date, displayMinutes = false, displayAsDeadline = false, transformToSpeech = true) {
static getMomentsDate (date, displayMinutes = false, displayMode = 0, transformToSpeech = true) {
let minutes = "";
let dateFormat = "D. MMMM YYYY";
if (displayMinutes === true) {
......@@ -62,32 +74,33 @@ export let Utilities = class Utilities {
if (!transformToSpeech) {
dateFormat = "DD";
return moment(date).locale(language).calendar(null, {
sameDay: dateFormat,
lastDay: dateFormat,
nextDay: dateFormat,
nextWeek: dateFormat,
lastWeek: dateFormat,
sameElse: dateFormat
});
}
if (displayAsDeadline) {
return moment(date).locale(language).calendar(null, {
sameDay: this.getCalendarString("today", minutes, displayAsDeadline),
lastDay: this.getCalendarString("yesterday", minutes, displayAsDeadline),
nextDay: this.getCalendarString("nextDay", minutes, displayAsDeadline),
nextWeek: this.getCalendarString(dateFormat, minutes, displayAsDeadline),
lastWeek: this.getCalendarString(dateFormat, minutes, displayAsDeadline),
sameElse: this.getCalendarString(dateFormat, minutes, displayAsDeadline)
sameDay: this.getCalendarString(dateFormat, minutes, displayMode),
lastDay: this.getCalendarString(dateFormat, minutes, displayMode),
nextDay: this.getCalendarString(dateFormat, minutes, displayMode),
nextWeek: this.getCalendarString(dateFormat, minutes, displayMode),
lastWeek: this.getCalendarString(dateFormat, minutes, displayMode),
sameElse: this.getCalendarString(dateFormat, minutes, displayMode)
});
} else {
return moment(date).locale(language).calendar(null, {
sameDay: this.getCalendarString("today", minutes),
lastDay: this.getCalendarString("yesterday", minutes),
nextDay: this.getCalendarString("nextDay", minutes),
nextWeek: this.getCalendarString(dateFormat, minutes),
lastWeek: this.getCalendarString(dateFormat, minutes),
sameElse: this.getCalendarString(dateFormat, minutes)
});
if (displayMode === 0) {
return moment(date).locale(language).calendar(null, {
sameDay: this.getCalendarString("today", minutes, displayMode),
lastDay: this.getCalendarString("yesterday", minutes, displayMode),
nextDay: this.getCalendarString("nextDay", minutes, displayMode),
nextWeek: this.getCalendarString(dateFormat, "", displayMode),
lastWeek: this.getCalendarString(dateFormat, "", displayMode),
sameElse: this.getCalendarString(dateFormat, "", displayMode)
});
} else {
return moment(date).locale(language).calendar(null, {
sameDay: this.getCalendarString("today", minutes, displayMode),
lastDay: this.getCalendarString("yesterday", minutes, displayMode),
nextDay: this.getCalendarString("nextDay", minutes, displayMode),
nextWeek: this.getCalendarString(dateFormat, minutes, displayMode),
lastWeek: this.getCalendarString(dateFormat, minutes, displayMode),
sameElse: this.getCalendarString(dateFormat, minutes, displayMode)
});
}
}
}
......
......@@ -763,8 +763,8 @@ Template.registerHelper("getDate", function () {
return moment(date).locale(Session.get('activeLanguage')).format('LL');
});
Template.registerHelper("getMomentsDate", function (date, displayMinutes = false, displayAsDeadline = false, transformToSpeech = true) {
return Utilities.getMomentsDate(date, displayMinutes, displayAsDeadline, transformToSpeech);
Template.registerHelper("getMomentsDate", function (date, displayMinutes = false, displayMode = 0, transformToSpeech = true) {
return Utilities.getMomentsDate(date, displayMinutes, displayMode, transformToSpeech);
});
Template.registerHelper("getMomentsDateShort", function (date) {
......
<template name="cardNavigationItemReview">
<div class="col-xs-12">
<div class="answerOptions">
{{#if isQuestionSide}}
<div id="answerButtons" class="btn-group btn-group-justified">
<div class="btn-group btn-bootstrap-container" role="group">
<button id="rateTranscript" class="btn btn-success btn-block btn-raised answer show-answer"
title="{{_ "cardset.transcriptBonusRating.navigation.rate"}}">{{_
"cardset.transcriptBonusRating.navigation.rate"}} {{#if
fullscreenActive}}
<span class="hidden-xs">( {{_ "key" key='y'}} )</span>{{/if}}</button>
{{#if canRateTranscript}}
{{#if isQuestionSide}}
<div id="answerButtons" class="btn-group btn-group-justified">
<div class="btn-group btn-bootstrap-container" role="group">
<button id="rateTranscript" class="btn btn-success btn-block btn-raised answer show-answer"
title="{{_ "cardset.transcriptBonusRating.navigation.rate"}}">{{_
"cardset.transcriptBonusRating.navigation.rate"}} {{#if
fullscreenActive}}
<span class="hidden-xs">( {{_ "key" key='y'}} )</span>{{/if}}</button>
</div>
{{#if isPresentationTranscriptReviewRoute}}
{{#unless gotOneCardLeft}}
<div class="btn-group btn-bootstrap-container" role="group">
<button href="#" id="skipTranscript"
class="btn btn-danger btn-block btn-raised answer show-answer"
title="{{_
"cardset.transcriptBonusRating.navigation.skip"}}" {{isPomodoroBreakActive}}>{{_
"cardset.transcriptBonusRating.navigation.skip"}} {{#if
fullscreenActive}}
<span class="hidden-xs">( {{_ "arrowKeys"}} )</span>{{/if}}</button>
</div>
{{/unless}}
{{/if}}
</div>
{{#if isPresentationTranscriptReviewRoute}}
{{#unless gotOneCardLeft}}
<div class="btn-group btn-bootstrap-container" role="group">
<button href="#" id="skipTranscript"
class="btn btn-danger btn-block btn-raised answer show-answer"
title="{{_
"cardset.transcriptBonusRating.navigation.skip"}}" {{isPomodoroBreakActive}}>{{_
"cardset.transcriptBonusRating.navigation.skip"}} {{#if
fullscreenActive}}
<span class="hidden-xs">( {{_ "arrowKeys"}} )</span>{{/if}}</button>
</div>
{{/unless}}
{{/if}}
</div>
{{else}}
<div id="rate-navigation" class="btn-group btn-group-justified">
<div class="btn-group btn-bootstrap-container" role="group">
<button class="btn btn-raised btn-warning answer card-fail" id="denyTranscript"
title="{{_
"cardset.transcriptBonusRating.navigation.deny"}}" {{isPomodoroBreakActive}}>{{_
"cardset.transcriptBonusRating.navigation.deny"}} {{#if fullscreenActive}}
<span class="hidden-xs">( {{_ "key" key='n'}} )</span>{{/if}}</button>
</div>
<div class="btn-group btn-bootstrap-container" role="group">
<button class="btn btn-raised btn-success answer card-success" id="acceptTranscript"
title="{{_
"cardset.transcriptBonusRating.navigation.accept"}}" {{isPomodoroBreakActive}}>{{_
"cardset.transcriptBonusRating.navigation.accept"}} {{#if fullscreenActive}}
<span class="hidden-xs">( {{_ "key" key='y'}} )</span>{{/if}}</button>
{{else}}
<div id="rate-navigation" class="btn-group btn-group-justified">
<div class="btn-group btn-bootstrap-container" role="group">
<button class="btn btn-raised btn-warning answer card-fail" id="denyTranscript"
title="{{_
"cardset.transcriptBonusRating.navigation.deny"}}" {{isPomodoroBreakActive}}>{{_
"cardset.transcriptBonusRating.navigation.deny"}} {{#if fullscreenActive}}
<span class="hidden-xs">( {{_ "key" key='n'}} )</span>{{/if}}</button>
</div>
<div class="btn-group btn-bootstrap-container" role="group">
<button class="btn btn-raised btn-success answer card-success" id="acceptTranscript"
title="{{_
"cardset.transcriptBonusRating.navigation.accept"}}" {{isPomodoroBreakActive}}>{{_
"cardset.transcriptBonusRating.navigation.accept"}} {{#if fullscreenActive}}
<span class="hidden-xs">( {{_ "key" key='y'}} )</span>{{/if}}</button>
</div>
</div>
</div>
{{/if}}
{{else}}
<button class="btn btn-warning btn-block btn-raised"
title="{{_ "cardset.transcriptBonusRating.navigation.notUnlocked"}}" disabled>{{_
"cardset.transcriptBonusRating.navigation.notUnlocked"}} </button>
{{/if}}
</div>
</div>
......
......@@ -4,6 +4,8 @@ import {Session} from "meteor/session";
import {CardVisuals} from "../../../../api/cardVisuals";
import {CardNavigation} from "../../../../api/cardNavigation";
import {BertAlertVisuals} from "../../../../api/bertAlertVisuals";
import {TranscriptBonus, TranscriptBonusList} from "../../../../api/transcriptBonus";
import {Route} from "../../../../api/route";
/*
* ############################################################################
......@@ -31,6 +33,14 @@ Template.cardNavigationItemReview.helpers({
if (Session.get('pomodoroBreakActive') === true) {
return "disabled";
}
},
canRateTranscript: function () {
if (Route.isPresentationTranscriptReview()) {
return true;
} else {
let transcriptBonus = TranscriptBonus.findOne({card_id: Router.current().params.card_id});
return TranscriptBonusList.isDeadlineExpired(transcriptBonus, true);
}
}
});
......
......@@ -9,7 +9,7 @@
{{#if isNewMonth this}}
<div class="col-xs-12 month">{{getMonth}}</div>
{{/if}}
<div class="{{getStatus this 0}} col-xs-2 day" title="{{getStatus this 1}}">{{getMomentsDate this.date false false false}}</div>
<div class="{{getStatus this 0}} col-xs-2 day" title="{{getStatus this 1}}">{{getMomentsDate this.date false 0 false}}</div>
{{/each}}
</div>
</td>
......
......@@ -2,6 +2,6 @@
<div class="resultItemHeader resultItemHeaderAuthor {{this.gridSize}} collapseButton {{getCardsetBackground
this.difficulty this.cardType}}"
data-date="{{this.date}}">
{{getMomentsDate this.date true false true}}
{{getMomentsDate this.date true 0 true}}
</div>
</template>
<template name="filterIndexItemTopDateModified">
<div class="resultItemHeader resultItemHeaderAuthor {{this.gridSize}} collapseButton {{getCardsetBackground
this.difficulty this.cardType}}" data-dateUpdated="{{this.dateUpdated}}">
{{getMomentsDate this.dateUpdated true false true}}
{{getMomentsDate this.dateUpdated true 0 true}}
</div>
</template>
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