Skip to content

Commit

Permalink
chore: update table and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ishowvel committed Jan 16, 2025
1 parent 070af86 commit ba8db72
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
27 changes: 13 additions & 14 deletions src/parser/github-comment-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,19 @@ export class GithubCommentModule extends BaseModule {
}

if (result.reviewRewards) {
const { baseRewardReviewCount, totalReward } = result.reviewRewards.reduce(
(acc, reviewReward) => {
if (reviewReward.reviewBaseReward?.reward) {
acc.baseRewardReviewCount++;
acc.totalReward += reviewReward.reviewBaseReward.reward;
}
return acc;
},
{ baseRewardReviewCount: 0, totalReward: 0 }
);

if (baseRewardReviewCount > 0) {
content.push(buildContributionRow("Review", "Base Review", baseRewardReviewCount, totalReward));
}
result.reviewRewards.forEach((reviewReward) => {
const reviewRewardPullNumber = reviewReward.url.split("/").slice(-1)[0];
if (reviewReward.reviewBaseReward?.reward) {
content.push(
buildContributionRow(
"Review",
`Base Review for&nbsp;<a href="${reviewReward.url}" target="_blank" rel="noopener">#${reviewRewardPullNumber}</a>`,
1,
reviewReward.reviewBaseReward?.reward
)
);
}
});

const reviewCount = result.reviewRewards.reduce(
(total, reviewReward) => total + (reviewReward.reviews?.length ?? 0),
Expand Down
2 changes: 1 addition & 1 deletion tests/__mocks__/results/github-comment-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,6 @@
}
}
],
"evaluationCommentHtml": "<details><summary><b><h3>&nbsp;<a href=\"undefined\" target=\"_blank\" rel=\"noopener\">[ 68.336 WXDAI ]</a>&nbsp;</h3><h6>@whilefoo</h6></b></summary><h6>Contributions Overview</h6><table><thead><tr><th>View</th><th>Contribution</th><th>Count</th><th>Reward</th></tr></thead><tbody><tr><td>Review</td><td>Base Review</td><td>1</td><td>25</td></tr><tr><td>Review</td><td>Code Review</td><td>7</td><td>7</td></tr><tr><td>Issue</td><td>Comment</td><td>1</td><td>13.6</td></tr><tr><td>Review</td><td>Comment</td><td>11</td><td>22.736</td></tr></tbody></table><h6>Review Details for&nbsp;<a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12\" target=\"_blank\" rel=\"noopener\">Pull Request</a></h6><table><thead><tr><th>Changes</th><th>Priority</th><th>Reward</th></tr></thead><tbody><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr></tbody></table><h6>Conversation Incentives</h6><table><thead><tr><th>Comment</th><th>Formatting</th><th>Relevance</th><th>Priority</th><th>Reward</th></tr></thead><tbody><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2035427134\" target=\"_blank\" rel=\"noopener\">there are a couple of options:1. we let the conversation-rewar&hellip;</a></h6></td><td><details><summary>16.99</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 6&#13; ol:&#13; score: 0&#13; elementCount: 1&#13; li:&#13; score: 1&#13; elementCount: 3&#13; result: 9&#13;regex:&#13; wordCount: 173&#13; wordValue: 0.1&#13; result: 7.99&#13;</pre></details></td><td>0.8</td><td>4</td><td>13.6</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574427305\" target=\"_blank\" rel=\"noopener\">&#96;&#96;&#96;suggestionreturn result;&#96;&#96;&#96;&hellip;</a></h6></td><td><details><summary>2.94</summary><pre>content:&#13; content:&#13; pre:&#13; score: 0&#13; elementCount: 1&#13; code:&#13; score: 1&#13; elementCount: 1&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 2&#13;regex:&#13; wordCount: 14&#13; wordValue: 0.1&#13; result: 0.94&#13;</pre></details></td><td>0.7</td><td>4</td><td>2.072</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574441918\" target=\"_blank\" rel=\"noopener\">I'm not sure if it's a good idea to rely on logs for testing, is&hellip;</a></h6></td><td><details><summary>2.54</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 25&#13; wordValue: 0.1&#13; result: 1.54&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.792</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574458540\" target=\"_blank\" rel=\"noopener\">why so many nested functions? it becomes hard to read</a></h6></td><td><details><summary>1.71</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 10&#13; wordValue: 0.1&#13; result: 0.71&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.204</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574460099\" target=\"_blank\" rel=\"noopener\">is there a reason we are using Decimal.js instead of native BigI&hellip;</a></h6></td><td><details><summary>1.88</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 13&#13; wordValue: 0.1&#13; result: 0.88&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.316</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574487172\" target=\"_blank\" rel=\"noopener\">Shouldn't task be issue opening item and specification is pull r&hellip;</a></h6></td><td><details><summary>2.49</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 24&#13; wordValue: 0.1&#13; result: 1.49&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.736</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574492061\" target=\"_blank\" rel=\"noopener\">I assume this is a permit for task assignee, but where are other&hellip;</a></h6></td><td><details><summary>2.28</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 20&#13; wordValue: 0.1&#13; result: 1.28&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.596</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1575851470\" target=\"_blank\" rel=\"noopener\">gotcha, I thought this html is for all users</a></h6></td><td><details><summary>1.65</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 9&#13; wordValue: 0.1&#13; result: 0.65&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.148</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1576482609\" target=\"_blank\" rel=\"noopener\">I can see from the example that it works correctly but when read&hellip;</a></h6></td><td><details><summary>7.38</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 3&#13; a:&#13; score: 1&#13; elementCount: 1&#13; result: 4&#13;regex:&#13; wordCount: 63&#13; wordValue: 0.1&#13; result: 3.38&#13;</pre></details></td><td>0.7</td><td>4</td><td>5.18</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1578040543\" target=\"_blank\" rel=\"noopener\">Ok so we need it for precise floating point calculations, in tha&hellip;</a></h6></td><td><details><summary>2.11</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 17&#13; wordValue: 0.1&#13; result: 1.11&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.484</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1578050965\" target=\"_blank\" rel=\"noopener\">why is it &#96;ISSUER&#96; which is meant for author of issue/re&hellip;</a></h6></td><td><details><summary>6.1</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 2&#13; code:&#13; score: 1&#13; elementCount: 2&#13; result: 4&#13;regex:&#13; wordCount: 36&#13; wordValue: 0.1&#13; result: 2.1&#13;</pre></details></td><td>0.7</td><td>4</td><td>4.284</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1579556333\" target=\"_blank\" rel=\"noopener\">this makes more sense!</a></h6></td><td><details><summary>1.32</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 4&#13; wordValue: 0.1&#13; result: 0.32&#13;</pre></details></td><td>0.7</td><td>4</td><td>0.924</td></tr></tbody></table></details>"
"evaluationCommentHtml": "<details><summary><b><h3>&nbsp;<a href=\"undefined\" target=\"_blank\" rel=\"noopener\">[ 68.336 WXDAI ]</a>&nbsp;</h3><h6>@whilefoo</h6></b></summary><h6>Contributions Overview</h6><table><thead><tr><th>View</th><th>Contribution</th><th>Count</th><th>Reward</th></tr></thead><tbody><tr><td>Review</td><td>Base Review for&nbsp;<a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12\" target=\"_blank\" rel=\"noopener\">#12</a></td><td>1</td><td>25</td></tr><tr><td>Review</td><td>Code Review</td><td>7</td><td>7</td></tr><tr><td>Issue</td><td>Comment</td><td>1</td><td>13.6</td></tr><tr><td>Review</td><td>Comment</td><td>11</td><td>22.736</td></tr></tbody></table><h6>Review Details for&nbsp;<a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12\" target=\"_blank\" rel=\"noopener\">Pull Request</a></h6><table><thead><tr><th>Changes</th><th>Priority</th><th>Reward</th></tr></thead><tbody><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr><tr><td>+50 -50</td><td>1</td><td>1</td></tr></tbody></table><h6>Conversation Incentives</h6><table><thead><tr><th>Comment</th><th>Formatting</th><th>Relevance</th><th>Priority</th><th>Reward</th></tr></thead><tbody><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2035427134\" target=\"_blank\" rel=\"noopener\">there are a couple of options:1. we let the conversation-rewar&hellip;</a></h6></td><td><details><summary>16.99</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 6&#13; ol:&#13; score: 0&#13; elementCount: 1&#13; li:&#13; score: 1&#13; elementCount: 3&#13; result: 9&#13;regex:&#13; wordCount: 173&#13; wordValue: 0.1&#13; result: 7.99&#13;</pre></details></td><td>0.8</td><td>4</td><td>13.6</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574427305\" target=\"_blank\" rel=\"noopener\">&#96;&#96;&#96;suggestionreturn result;&#96;&#96;&#96;&hellip;</a></h6></td><td><details><summary>2.94</summary><pre>content:&#13; content:&#13; pre:&#13; score: 0&#13; elementCount: 1&#13; code:&#13; score: 1&#13; elementCount: 1&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 2&#13;regex:&#13; wordCount: 14&#13; wordValue: 0.1&#13; result: 0.94&#13;</pre></details></td><td>0.7</td><td>4</td><td>2.072</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574441918\" target=\"_blank\" rel=\"noopener\">I'm not sure if it's a good idea to rely on logs for testing, is&hellip;</a></h6></td><td><details><summary>2.54</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 25&#13; wordValue: 0.1&#13; result: 1.54&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.792</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574458540\" target=\"_blank\" rel=\"noopener\">why so many nested functions? it becomes hard to read</a></h6></td><td><details><summary>1.71</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 10&#13; wordValue: 0.1&#13; result: 0.71&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.204</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574460099\" target=\"_blank\" rel=\"noopener\">is there a reason we are using Decimal.js instead of native BigI&hellip;</a></h6></td><td><details><summary>1.88</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 13&#13; wordValue: 0.1&#13; result: 0.88&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.316</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574487172\" target=\"_blank\" rel=\"noopener\">Shouldn't task be issue opening item and specification is pull r&hellip;</a></h6></td><td><details><summary>2.49</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 24&#13; wordValue: 0.1&#13; result: 1.49&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.736</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1574492061\" target=\"_blank\" rel=\"noopener\">I assume this is a permit for task assignee, but where are other&hellip;</a></h6></td><td><details><summary>2.28</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 20&#13; wordValue: 0.1&#13; result: 1.28&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.596</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1575851470\" target=\"_blank\" rel=\"noopener\">gotcha, I thought this html is for all users</a></h6></td><td><details><summary>1.65</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 9&#13; wordValue: 0.1&#13; result: 0.65&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.148</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1576482609\" target=\"_blank\" rel=\"noopener\">I can see from the example that it works correctly but when read&hellip;</a></h6></td><td><details><summary>7.38</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 3&#13; a:&#13; score: 1&#13; elementCount: 1&#13; result: 4&#13;regex:&#13; wordCount: 63&#13; wordValue: 0.1&#13; result: 3.38&#13;</pre></details></td><td>0.7</td><td>4</td><td>5.18</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1578040543\" target=\"_blank\" rel=\"noopener\">Ok so we need it for precise floating point calculations, in tha&hellip;</a></h6></td><td><details><summary>2.11</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 17&#13; wordValue: 0.1&#13; result: 1.11&#13;</pre></details></td><td>0.7</td><td>4</td><td>1.484</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1578050965\" target=\"_blank\" rel=\"noopener\">why is it &#96;ISSUER&#96; which is meant for author of issue/re&hellip;</a></h6></td><td><details><summary>6.1</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 2&#13; code:&#13; score: 1&#13; elementCount: 2&#13; result: 4&#13;regex:&#13; wordCount: 36&#13; wordValue: 0.1&#13; result: 2.1&#13;</pre></details></td><td>0.7</td><td>4</td><td>4.284</td></tr><tr><td><h6><a href=\"https://github.com/ubiquity-os/conversation-rewards/pull/12#discussion_r1579556333\" target=\"_blank\" rel=\"noopener\">this makes more sense!</a></h6></td><td><details><summary>1.32</summary><pre>content:&#13; content:&#13; p:&#13; score: 1&#13; elementCount: 1&#13; result: 1&#13;regex:&#13; wordCount: 4&#13; wordValue: 0.1&#13; result: 0.32&#13;</pre></details></td><td>0.7</td><td>4</td><td>0.924</td></tr></tbody></table></details>"
}
}
2 changes: 1 addition & 1 deletion tests/__mocks__/results/output.html

Large diffs are not rendered by default.

0 comments on commit ba8db72

Please sign in to comment.