BigW Consortium Gitlab

discussion.js.es6 833 Bytes
Newer Older
1 2 3 4 5 6
((w) => {
  w.DiscussionMixins = {
    computed: {
      discussionCount: function () {
        return Object.keys(this.discussions).length;
      },
7
      resolvedDiscussionCount: function () {
8 9 10 11 12 13 14 15 16 17 18 19 20 21
        let resolvedCount = 0;

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

          if (discussion.isResolved()) {
            resolvedCount++;
          }
        }

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

23 24 25 26 27 28 29 30 31 32 33 34 35
        for (const discussionId in this.discussions) {
          const discussion = this.discussions[discussionId];

          if (!discussion.isResolved()) {
            unresolvedCount++;
          }
        }

        return unresolvedCount;
      }
    }
  };
})(window);