Commit 6a6325e3 authored by Curtis Adam's avatar Curtis Adam

Show the transcript rating on bonus transcripts

parent 8cfaf747
......@@ -88,6 +88,11 @@ $themes: (
$card_counter_text: map-get($map, "card_counter_text");
$transcript_counter_background: map-get($map, "transcript_counter_background");
$transcript_counter_text: map-get($map, "transcript_counter_text");
$transcript_rating_label_background: map-get($map, "transcript_rating_label_background");
$transcript_rating_label_text: map-get($map, "transcript_rating_label_text");
$transcript_rating_pending_icon: map-get($map, "transcript_rating_pending_icon");
$transcript_rating_accepted_icon: map-get($map, "transcript_rating_accepted_icon");
$transcript_rating_denied_icon: map-get($map, "transcript_rating_denied_icon");
//barfy stars
$barfy_stars_particles_1: map-get($map, "barfy_stars_particles_1");
$barfy_stars_particles_2: map-get($map, "barfy_stars_particles_2");
......@@ -2784,6 +2789,23 @@ $themes: (
}
}
.label-transcript-rating {
background-color: $transcript_rating_label_background !important;
color: $transcript_rating_label_text !important;
}
.transcript-rating-pending::before {
color: $transcript_rating_pending_icon !important;
}
.transcript-rating-accepted::before {
color: $transcript_rating_accepted_icon !important;
}
.transcript-rating-denied::before {
color: $transcript_rating_denied_icon !important;
}
.label-count-cards {
background-color: $card_counter_background !important;
color: $card_counter_text!important;
......
......@@ -123,6 +123,11 @@
"card_counter_text": white,
"transcript_counter_background": $thm_orange,
"transcript_counter_text": white,
"transcript_rating_label_background": indigo,
"transcript_rating_label_text": white,
"transcript_rating_pending_icon": $thm_orange,
"transcript_rating_accepted_icon": $thm_green,
"transcript_rating_denied_icon": $thm_red,
//barfy stars
"barfy_stars_particles_1": $thm_blue,
"barfy_stars_particles_2": $thm_orange,
......@@ -626,8 +631,8 @@
"transcript_bonus_submission_count_badge_background": $thm_orange,
//transcript bonus user statistics colors
"transcript_bonus_user_statistics_name_background": LightGoldenRodYellow,
"transcript_bonus_user_statistics_details_background": $thm_gray,
"transcript_bonus_user_statistics_details_text": white,
"transcript_bonus_user_statistics_details_background": white,
"transcript_bonus_user_statistics_details_text": black,
//markdeep editor colors
"markdeep_help_text": $white,
"markdeep_help_background": $thm_orange,
......
......@@ -733,7 +733,10 @@
}
},
"statistics": {
"lastSubmission": "Letzte Abgabe"
"lastSubmission": "Letzte Abgabe",
"pending": "Noch nicht bewertet",
"accepted": "Akzeptiert",
"denied": "Abgelehnt"
}
}
},
......@@ -1196,6 +1199,15 @@
},
"list": {
"back": " Zurück zur Karte"
},
"transcriptBonusRating": {
"long": "Bewertung",
"short": "Bewertung",
"tooltip": {
"pending": "Die Mitschrift wurde noch nicht bewertet",
"accepted": "Die Mitschrift wurde akzeptiert",
"denied": "Die Mitschrift wurde abgelehnt"
}
}
},
"rating-field": {
......
......@@ -735,7 +735,10 @@
}
},
"statistics": {
"lastSubmission": "Letzte Abgabe"
"lastSubmission": "Letzte Abgabe",
"pending": "Noch nicht bewertet",
"accepted": "Akzeptiert",
"denied": "Abgelehnt"
}
}
},
......@@ -1198,6 +1201,15 @@
},
"list": {
"back": " Zurück zur Karte"
},
"transcriptBonusRating": {
"long": "Bewertung",
"short": "Bewertung",
"tooltip": {
"pending": "Die Mitschrift wurde noch nicht bewertet",
"accepted": "Die Mitschrift wurde akzeptiert",
"denied": "Die Mitschrift wurde abgelehnt"
}
}
},
"rating-field": {
......
......@@ -6,6 +6,7 @@ import {SimpleSchema} from "meteor/aldeed:simple-schema";
import {check} from "meteor/check";
import {Utilities} from "./utilities";
import * as config from "../config/transcriptBonus.js";
import * as icons from "../config/icons.js";
export const TranscriptBonus = new Mongo.Collection("transcriptBonus");
......@@ -52,6 +53,10 @@ const TranscriptBonusSchema = new SimpleSchema({
},
deadlineEditing: {
type: Number
},
rating: {
type: Number,
optional: true
}
});
......@@ -76,7 +81,8 @@ Meteor.methods({
lectureEnd: cardset.transcriptBonus.lectureEnd,
deadline: cardset.transcriptBonus.deadline,
deadlineEditing: cardset.transcriptBonus.deadlineEditing,
dateCreated: new Date()
dateCreated: new Date(),
rating: 0
}
});
}
......@@ -200,4 +206,26 @@ export let TranscriptBonusList = class TranscriptBonusList {
return median.toFixed(1);
}
}
static getBonusTranscriptRating (type = 0) {
switch (type) {
case 1:
return icons.transcriptIcons.ratingAccepted;
case 2:
return icons.transcriptIcons.ratingDenied;
default:
return icons.transcriptIcons.ratingPending;
}
}
static getBonusTranscriptTooltip (type = 0) {
switch (type) {
case 1:
return TAPi18n.__('cardset.transcriptBonusRating.tooltip.accepted');
case 2:
return TAPi18n.__('cardset.transcriptBonusRating.tooltip.denied');
default:
return TAPi18n.__('cardset.transcriptBonusRating.tooltip.pending');
}
}
};
......@@ -86,6 +86,12 @@ let useCasesIcons = {
"search": "<i class='fa fas fa-search'></i>&nbsp;"
};
let transcriptIcons = {
"ratingPending": '<i class="transcript-rating-pending fas fa-hourglass"></i>',
"ratingAccepted": '<i class="transcript-rating-accepted fas fa-check-circle"></i>',
"ratingDenied": '<i class="transcript-rating-denied fas fa-times-circle"></i>'
};
module.exports = {
footerNavigation: footerNavigation,
topNavigation: topNavigation,
......@@ -93,5 +99,6 @@ module.exports = {
landingPageNavigation,
aspectRatio,
useCasesIcons,
labels
labels,
transcriptIcons
};
......@@ -1057,6 +1057,19 @@ Meteor.startup(function () {
}, {multi: true});
}
transcriptBonus = TranscriptBonus.find({"rating": {$exists: false}}).fetch();
for (let i = 0; i < transcriptBonus.length; i++) {
TranscriptBonus.update({
_id: transcriptBonus[i]._id
},
{
$set: {
rating: 0
}
}
);
}
Cardsets.remove({cardType: 2});
Meteor.users.remove(demoCardsetUser[0]._id);
Meteor.users.insert(demoCardsetUser[0]);
......
......@@ -600,4 +600,4 @@ th .field-tip {
.year + .month {
margin-top: 5px;
}
}
\ No newline at end of file
}
......@@ -29,5 +29,6 @@
{{{getBonusLabel this.learningActive}}}
{{{getTranscriptBonusLabel this}}}
{{> filterIndexItemBottomDeadline}}
{{> filterIndexItemBottomTranscriptRating}}
</span>
</template>
......@@ -29,15 +29,39 @@
<tbody>
<tr>
<td>
{{_ "transcriptForm.info.submissions"}}:
<i class="fas fa-clipboard"></i>&nbsp;{{_ "transcriptForm.info.submissions"}}:
</td>
<td>
{{getSubmissions this._id}}
{{getSubmissions this._id undefined}}
</td>
</tr>
<tr>
<td>
{{_ "transcriptForm.bonus.statistics.lastSubmission"}}:
{{{getBonusTranscriptRating 0}}}&nbsp;{{_ "transcriptForm.bonus.statistics.pending"}}:
</td>
<td>
{{getSubmissions this._id 0}}
</td>
</tr>
<tr>
<td>
{{{getBonusTranscriptRating 1}}}&nbsp;{{_ "transcriptForm.bonus.statistics.accepted"}}:
</td>
<td>
{{getSubmissions this._id 1}}
</td>
</tr>
<tr>
<td>
{{{getBonusTranscriptRating 2}}}&nbsp;{{_ "transcriptForm.bonus.statistics.denied"}}:
</td>
<td>
{{getSubmissions this._id 2}}
</td>
</tr>
<tr>
<td>
<i class="far fa-calendar"></i>&nbsp;{{_ "transcriptForm.bonus.statistics.lastSubmission"}}:
</td>
<td>
{{lastSubmission this._id}}
......
......@@ -29,13 +29,20 @@ Template.cardsetTranscriptStatistics.helpers({
}), true);
return Meteor.users.find({_id: {$in: transcriptBonusUsers}}, {sort: {"profile.birthname": 1}, fields: {_id: 1}}).fetch();
},
getSubmissions: function (id) {
return TranscriptBonus.find({cardset_id: Router.current().params._id, user_id: id}).count();
getSubmissions: function (id, rating = undefined) {
let query = {cardset_id: Router.current().params._id, user_id: id};
if (rating !== undefined) {
query.rating = rating;
}
return TranscriptBonus.find(query).count();
},
lastSubmission: function (id) {
let bonusTranscript = TranscriptBonus.findOne({user_id: id}, {sort: {date: -1}});
if (bonusTranscript !== undefined) {
return TranscriptBonusList.getLectureName(bonusTranscript, false);
}
},
getBonusTranscriptRating: function (type) {
return TranscriptBonusList.getBonusTranscriptRating(type);
}
});
......@@ -32,6 +32,7 @@ import "./item/bottom/export.js";
import "./item/bottom/leaveWorkload.js";
import "./item/bottom/shuffle.js";
import "./item/bottom/workloadProgress.js";
import "./item/bottom/transcriptRating.js";
import "./item/collapse/collapse.js";
import "./item/titleRow/author.js";
import "./item/titleRow/dateCreated.js";
......
<template name="filterIndexItemBottomTranscriptRating">
{{#if isBonusTranscriptsRoute}}
<span class="label label-transcript-rating" title="{{getBonusTranscriptTooltip this._id}}">
<span class="hidden-xs">{{_ "cardset.transcriptBonusRating.long"}}:</span>
<span class="visible-xs">{{_ "cardset.transcriptBonusRating.short"}}:</span>
&nbsp;{{{getBonusTranscriptRating this._id}}}
</span>
{{/if}}
</template>
import "./transcriptRating.html";
import {Template} from "meteor/templating";
import {TranscriptBonus, TranscriptBonusList} from "../../../../../api/transcriptBonus";
/*
* ############################################################################
* filterIndexItemBottomTranscriptRating
* ############################################################################
*/
Template.filterIndexItemBottomTranscriptRating.helpers({
getBonusTranscriptRating: function (id) {
let rating = TranscriptBonus.findOne({card_id: id}).rating;
return TranscriptBonusList.getBonusTranscriptRating(rating);
},
getBonusTranscriptTooltip: function (id) {
let rating = TranscriptBonus.findOne({card_id: id}).rating;
return TranscriptBonusList.getBonusTranscriptTooltip(rating);
}
});
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