Skip to content

Commit

Permalink
Flag games with detected AI use
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyMineshaft committed Nov 15, 2023
1 parent ea1bdf3 commit f2ea547
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions src/views/User/GameHistoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type ResultClass = `library-${"won" | "lost" | "tie"}-result${
| ""}`;

interface GroomedGame {
bot_detection_results: Record<string, any>;
id: number;
annulled: boolean;
ranked: boolean;
Expand Down Expand Up @@ -189,6 +190,7 @@ export function GameHistoryTable(props: GameHistoryProps) {
item.href = `/game/${item.id}`;
item.result = getGameResultRichText(r);
item.flags = r.flags && props.user_id in r.flags ? r.flags[props.user_id] : undefined;
item.bot_detection_results = r.bot_detection_results;

ret.push(item);
}
Expand Down Expand Up @@ -406,17 +408,33 @@ export function GameHistoryTable(props: GameHistoryProps) {
className: (X) =>
X ? X.result_class + (X.annulled ? " annulled" : "") : "",
render: (X) => {
if (!hide_flags && X.flags) {
if (
!hide_flags &&
(X.flags ||
X.bot_detection_results?.ai_suspected.includes(
props.user_id,
))
) {
let str = "";
for (const flag of Object.keys(X.flags)) {
if (flag === "blur_rate") {
str +=
flag +
": " +
Math.round((X.flags[flag] as number) * 100.0) +
"%\n";
} else {
str += flag + ": " + X.flags[flag] + "\n";
if (
X.bot_detection_results?.ai_suspected.includes(
props.user_id,
)
) {
str += "AI Suspected";
} else if (X.flags) {
for (const flag of Object.keys(X.flags)) {
if (flag === "blur_rate") {
str +=
flag +
": " +
Math.round(
(X.flags[flag] as number) * 100.0,
) +
"%\n";
} else {
str += flag + ": " + X.flags[flag] + "\n";
}
}
}

Expand Down

0 comments on commit f2ea547

Please sign in to comment.