discussion.js 897 Bytes
Newer Older
1
/* eslint-disable object-shorthand, func-names, guard-for-in, no-restricted-syntax, comma-dangle, no-param-reassign, max-len */
2

3 4 5 6 7 8 9
window.DiscussionMixins = {
  computed: {
    discussionCount: function () {
      return Object.keys(this.discussions).length;
    },
    resolvedDiscussionCount: function () {
      let resolvedCount = 0;
10

11 12
      for (const discussionId in this.discussions) {
        const discussion = this.discussions[discussionId];
13

14 15
        if (discussion.isResolved()) {
          resolvedCount += 1;
16
        }
17
      }
18

19 20 21 22
      return resolvedCount;
    },
    unresolvedDiscussionCount: function () {
      let unresolvedCount = 0;
23

24 25
      for (const discussionId in this.discussions) {
        const discussion = this.discussions[discussionId];
26

27 28
        if (!discussion.isResolved()) {
          unresolvedCount += 1;
29 30
        }
      }
31 32

      return unresolvedCount;
33
    }
34 35
  }
};