Commit b04a2b7a authored by Curtis Adam's avatar Curtis Adam
Browse files

Fix error count not displaying on every route if used inside the use case modal

parent 425f2996
<template name="cardsetLabelsItemErrorReporting">
{{#if hasCardsetUnresolvedErrors this._id}}
{{#if cardsetErrorCount}}
<span class="label show-error label-error-reporting" title="{{_ 'label.errorReporting.long'}}" data-id="{{this._id}}">
<span class="fas fa-bullhorn" data-id="{{this._id}}"></span>
{{_ 'label.errorReporting.title'}} ({{getErrorCountFromCardset this._id}})
{{_ 'label.errorReporting.title'}} ({{cardsetErrorCount}})
</span>
{{/if}}
</template>
\ No newline at end of file
</template>
......@@ -3,20 +3,21 @@ import {Template} from "meteor/templating";
import {Session} from "meteor/session";
import {FlowRouter} from "meteor/ostrio:flow-router-extra";
import * as RouteNames from "../../../../util/routeNames";
import {ErrorReporting} from "../../../../util/errorReporting";
Template.cardsetLabelsItemErrorReporting.events({
'click .show-error': function (event) {
Session.set('showOnlyErrorReports', true);
$('#useCasesModal').modal('hide');
FlowRouter.go(RouteNames.presentationlist, {_id: $(event.target).data('id')});
}
});
Template.cardsetLabelsItemErrorReporting.helpers({
hasCardsetUnresolvedErrors: function (cardset_id) {
return ErrorReporting.getErrorCountFromCardset(cardset_id) > 0;
},
getErrorCountFromCardset: function (cardset_id) {
return ErrorReporting.getErrorCountFromCardset(cardset_id);
cardsetErrorCount: function () {
if (this.unresolvedErrors === undefined) {
return 0;
} else {
return this.unresolvedErrors;
}
}
});
import {CardNavigation} from "./cardNavigation";
import {Session} from "meteor/session";
import {Cards} from "../api/subscriptions/cards";
import {Cardsets} from "../api/subscriptions/cardsets";
export let ErrorReporting = class ErrorReporting {
......@@ -85,14 +84,6 @@ export let ErrorReporting = class ErrorReporting {
return unresolvedErrors;
}
static getErrorCountFromCardset (cardset_id) {
let errorCount = 0;
Cardsets.find({_id: cardset_id}, {unresolvedErrors: 1}).forEach(cardset => {
errorCount = cardset.unresolvedErrors;
});
return errorCount;
}
static getErrorCountFromCard (card_id) {
let errorCount = 0;
Cards.find({_id: card_id}, {unresolvedErrors: 1}).forEach(card => {
......
Supports Markdown
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