Skip to content

Commit a41c16d

Browse files
committed
fix(web): juror dashboard coherency fix
1 parent ddc232a commit a41c16d

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

web/src/pages/Dashboard/JurorInfo/Coherency.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,34 @@ const Container = styled.div`
1919

2020
const tooltipMsg =
2121
"A Coherent Vote is a vote coherent with the final jury decision" +
22-
" (after all the appeal instances). Your coherency score is calculated" +
23-
" using the number of times you have been coherent and the total cases you" +
24-
" have been in.";
22+
" (after all the appeal instances). If the juror vote is the same as " +
23+
" the majority of jurors it's considered a Coherent Vote.";
2524

2625
interface ICoherency {
2726
userLevelData: {
2827
scoreRange: number[];
2928
level: number;
3029
title: string;
3130
};
32-
score: number;
31+
totalCoherent: number;
32+
totalResolvedDisputes: number;
3333
}
3434

35-
const Coherency: React.FC<ICoherency> = ({ userLevelData, score }) => {
35+
const Coherency: React.FC<ICoherency> = ({ userLevelData, totalCoherent, totalResolvedDisputes }) => {
3636
return (
3737
<Container>
3838
<small>{userLevelData.title}</small>
3939
<label>Level {userLevelData.level}</label>
40-
<CircularProgress progress={parseFloat(score.toFixed(2))} />
40+
<CircularProgress
41+
progress={parseFloat(((totalCoherent / Math.max(totalResolvedDisputes, 1)) * 100).toFixed(2))}
42+
/>
4143
<WithHelpTooltip place="left" {...{ tooltipMsg }}>
4244
<label>
43-
Coherency Score:
44-
<small> {score.toFixed(2)} </small>
45+
Coherent Votes:
46+
<small>
47+
{" "}
48+
{totalCoherent}/{totalResolvedDisputes}{" "}
49+
</small>
4550
</label>
4651
</WithHelpTooltip>
4752
</Container>

web/src/pages/Dashboard/JurorInfo/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const JurorInfo: React.FC = () => {
4040
const { address } = useAccount();
4141
const { data } = useUserQuery(address?.toLowerCase());
4242
const coherenceScore = data?.user ? parseInt(data?.user?.coherenceScore) : 0;
43+
const totalCoherent = data?.user ? parseInt(data?.user?.totalCoherent) : 0;
44+
const totalResolvedDisputes = data?.user ? parseInt(data?.user?.totalResolvedDisputes) : 0;
4345

4446
const userLevelData = getUserLevelData(coherenceScore);
4547

@@ -48,7 +50,11 @@ const JurorInfo: React.FC = () => {
4850
<Header>Juror Dashboard</Header>
4951
<Card>
5052
<PixelArt level={userLevelData.level} width="189px" height="189px" />
51-
<Coherency userLevelData={userLevelData} score={coherenceScore} />
53+
<Coherency
54+
userLevelData={userLevelData}
55+
totalCoherent={totalCoherent}
56+
totalResolvedDisputes={totalResolvedDisputes}
57+
/>
5258
<JurorRewards />
5359
</Card>
5460
</Container>

0 commit comments

Comments
 (0)