2019-09-18 14:02:45 +00:00
|
|
|
/* eslint-disable guard-for-in, no-restricted-syntax, */
|
2016-12-14 03:01:05 +00:00
|
|
|
|
2018-06-16 13:20:30 +00:00
|
|
|
const DiscussionMixins = {
|
2017-04-17 06:35:56 +00:00
|
|
|
computed: {
|
2019-09-18 14:02:45 +00:00
|
|
|
discussionCount() {
|
2017-04-17 06:35:56 +00:00
|
|
|
return Object.keys(this.discussions).length;
|
|
|
|
},
|
2019-09-18 14:02:45 +00:00
|
|
|
resolvedDiscussionCount() {
|
2017-04-17 06:35:56 +00:00
|
|
|
let resolvedCount = 0;
|
2016-08-04 08:52:17 +00:00
|
|
|
|
2017-04-17 06:35:56 +00:00
|
|
|
for (const discussionId in this.discussions) {
|
|
|
|
const discussion = this.discussions[discussionId];
|
2016-08-04 08:52:17 +00:00
|
|
|
|
2017-04-17 06:35:56 +00:00
|
|
|
if (discussion.isResolved()) {
|
|
|
|
resolvedCount += 1;
|
2016-08-04 08:52:17 +00:00
|
|
|
}
|
2017-04-17 06:35:56 +00:00
|
|
|
}
|
2016-08-04 08:52:17 +00:00
|
|
|
|
2017-04-17 06:35:56 +00:00
|
|
|
return resolvedCount;
|
|
|
|
},
|
2019-09-18 14:02:45 +00:00
|
|
|
unresolvedDiscussionCount() {
|
2017-04-17 06:35:56 +00:00
|
|
|
let unresolvedCount = 0;
|
2016-08-05 01:01:32 +00:00
|
|
|
|
2017-04-17 06:35:56 +00:00
|
|
|
for (const discussionId in this.discussions) {
|
|
|
|
const discussion = this.discussions[discussionId];
|
2016-08-04 08:52:17 +00:00
|
|
|
|
2017-04-17 06:35:56 +00:00
|
|
|
if (!discussion.isResolved()) {
|
|
|
|
unresolvedCount += 1;
|
2016-08-04 08:52:17 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-17 06:35:56 +00:00
|
|
|
|
|
|
|
return unresolvedCount;
|
2018-10-10 06:15:56 +00:00
|
|
|
},
|
|
|
|
},
|
2017-04-17 06:35:56 +00:00
|
|
|
};
|
2018-06-16 13:20:30 +00:00
|
|
|
|
|
|
|
export default DiscussionMixins;
|