diff --git a/client-report/src/components/beeswarm/beeswarm.jsx b/client-report/src/components/beeswarm/beeswarm.jsx
index 744bdcf54..22dfd89aa 100644
--- a/client-report/src/components/beeswarm/beeswarm.jsx
+++ b/client-report/src/components/beeswarm/beeswarm.jsx
@@ -1,7 +1,7 @@
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .
import React, { useState, useEffect } from "react";
-import CommentList from "../lists/commentList";
+import CommentList from "../lists/commentList.jsx";
import * as globals from "../globals";
import _ from "lodash";
// import Flex from "../framework/flex"
diff --git a/client-report/src/components/lists/allCommentsModeratedIn.jsx b/client-report/src/components/lists/allCommentsModeratedIn.jsx
index bdbd68751..f4f80b0d4 100644
--- a/client-report/src/components/lists/allCommentsModeratedIn.jsx
+++ b/client-report/src/components/lists/allCommentsModeratedIn.jsx
@@ -1,7 +1,7 @@
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .
import React, { useState } from "react";
-import CommentList from "./commentList";
+import CommentList from "./commentList.jsx";
import * as globals from "../globals";
diff --git a/client-report/src/components/lists/allCommentsModeratedIn.test.jsx b/client-report/src/components/lists/allCommentsModeratedIn.test.jsx
index 497deed09..ad3c02af3 100644
--- a/client-report/src/components/lists/allCommentsModeratedIn.test.jsx
+++ b/client-report/src/components/lists/allCommentsModeratedIn.test.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import AllCommentsModeratedIn from './allCommentsModeratedIn.jsx';
-import CommentList from './commentList.js';
+import CommentList from './commentList.jsx';
jest.mock('./commentList', () => ({
__esModule: true,
diff --git a/client-report/src/components/lists/commentList.js b/client-report/src/components/lists/commentList.jsx
similarity index 75%
rename from client-report/src/components/lists/commentList.js
rename to client-report/src/components/lists/commentList.jsx
index d5f8e4d68..0844a1037 100644
--- a/client-report/src/components/lists/commentList.js
+++ b/client-report/src/components/lists/commentList.jsx
@@ -1,7 +1,6 @@
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .
import React from "react";
-import _ from "lodash";
import * as globals from "../globals";
const BarChartCompact = ({ comment, voteCounts, nMembers, voteColors }) => {
@@ -82,17 +81,17 @@ const CommentRow = ({ comment, groups, voteColors }) => {
console.error("WHY IS THERE NO COMMENT 3452354235", comment);
return null;
}
- // const percentAgreed = Math.floor(groupVotesForThisGroup.votes[comment.tid].A / groupVotesForThisGroup.votes[comment.tid].S * 100);
let BarCharts = [];
let totalMembers = 0;
// groups
- _.forEach(groups, (g, i) => {
- let nMembers = g["n-members"];
+ Object.entries(groups).forEach(([key, g]) => {
+ const i = parseInt(key, 10); // Parse the key to an integer
+ const nMembers = g["n-members"];
totalMembers += nMembers;
- let gVotes = g.votes[comment.tid];
-
+ const gVotes = g.votes[comment.tid];
+
BarCharts.push(
{
);
});
- // totals column
- // let globalCounts = {
- // A: comment.agreed,
- // D: comment.disagreed,
- // S: comment.saw,
- // };
BarCharts.unshift(
{
);
};
-class CommentList extends React.Component {
- constructor(props) {
- super(props)
- }
- getGroupLabels() {
+const CommentList = ({ comments, math, ptptCount, tidsToRender, voteColors }) => {
+
+ const getGroupLabels = () => {
function makeLabel(key, label, numMembers) {
return (
{
+ Object.entries(math["group-votes"]).forEach(([key, g]) => {
+ const i = parseInt(key, 10);
labels.push(makeLabel(i, globals.groupLabels[i], g["n-members"]));
});
return labels;
}
- render() {
- const comments = _.keyBy(this.props.comments, "tid");
+ const cs = comments.reduce((acc, comment) => {
+ acc[comment.tid] = comment;
+ return acc;
+ }, {});
- return (
-
+ );
}
export default CommentList;
diff --git a/client-report/src/components/lists/consensusNarrative.js b/client-report/src/components/lists/consensusNarrative.js
index 8a24c6850..3d4b58b3f 100644
--- a/client-report/src/components/lists/consensusNarrative.js
+++ b/client-report/src/components/lists/consensusNarrative.js
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import * as globals from "../globals";
import Narrative from "../narrative";
-import CommentList from "./commentList";
+import CommentList from "./commentList.jsx";
const ConsensusNarrative = ({
math,
comments,
diff --git a/client-report/src/components/lists/majorityStrict.js b/client-report/src/components/lists/majorityStrict.js
index e3373d71b..cf8d7454f 100644
--- a/client-report/src/components/lists/majorityStrict.js
+++ b/client-report/src/components/lists/majorityStrict.js
@@ -2,7 +2,7 @@
import React from "react";
import * as globals from "../globals";
-import CommentList from "./commentList";
+import CommentList from "./commentList.jsx";
import Legend from "../framework/legend.jsx";
const MajorityStrict = ({
diff --git a/client-report/src/components/lists/metadata.js b/client-report/src/components/lists/metadata.js
index ecc016f20..e1bfe265f 100644
--- a/client-report/src/components/lists/metadata.js
+++ b/client-report/src/components/lists/metadata.js
@@ -1,7 +1,7 @@
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .
import React from "react";
-import CommentList from "./commentList";
+import CommentList from "./commentList.jsx";
import * as globals from "../globals";
const Metadata = ({ conversation, comments, ptptCount, formatTid, math, voteColors }) => {
diff --git a/client-report/src/components/lists/participantGroup.js b/client-report/src/components/lists/participantGroup.js
index 19f580a07..444ec3900 100644
--- a/client-report/src/components/lists/participantGroup.js
+++ b/client-report/src/components/lists/participantGroup.js
@@ -4,7 +4,7 @@ import React from "react";
import * as globals from "../globals";
// import Flex from "../framework/flex"
// import style from "../../util/style";
-import CommentList from "./commentList";
+import CommentList from "./commentList.jsx";
const ParticipantGroup = ({
gid,
diff --git a/client-report/src/components/lists/uncertainty.js b/client-report/src/components/lists/uncertainty.js
index fe42b9eff..d7c9a41db 100644
--- a/client-report/src/components/lists/uncertainty.js
+++ b/client-report/src/components/lists/uncertainty.js
@@ -1,7 +1,7 @@
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .
import React from "react";
-import CommentList from "./commentList";
+import CommentList from "./commentList.jsx";
import * as globals from "../globals";
// import style from "../../util/style";
import Narrative from "../narrative";
diff --git a/client-report/src/components/lists/uncertaintyNarrative.js b/client-report/src/components/lists/uncertaintyNarrative.js
index ceb115675..3ea454977 100644
--- a/client-report/src/components/lists/uncertaintyNarrative.js
+++ b/client-report/src/components/lists/uncertaintyNarrative.js
@@ -1,7 +1,7 @@
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .
import React from "react";
-import CommentList from "./commentList";
+import CommentList from "./commentList.jsx";
import * as globals from "../globals";
// import style from "../../util/style";
import Narrative from "../narrative";
diff --git a/client-report/src/components/participantsGraph/participantsGraph.js b/client-report/src/components/participantsGraph/participantsGraph.js
index a7ba3b80a..12dfed5db 100644
--- a/client-report/src/components/participantsGraph/participantsGraph.js
+++ b/client-report/src/components/participantsGraph/participantsGraph.js
@@ -10,7 +10,7 @@ import * as d3chromatic from "d3-scale-chromatic";
// import GroupLabels from "./groupLabels";
import Comments from "../commentsGraph/comments.jsx";
import Hull from "./hull";
-import CommentList from "../lists/commentList";
+import CommentList from "../lists/commentList.jsx";
const pointsPerSquarePixelMax = 0.0017; /* choose dynamically ? */
const contourBandwidth = 20;