fix: make ferv csv stuff more obvious

This commit is contained in:
zkldi
2023-02-28 01:14:58 +00:00
parent 0ac294ea51
commit 91e082e4e9
4 changed files with 34 additions and 2 deletions
@@ -3,6 +3,8 @@ import Divider from "components/util/Divider";
import ExternalLink from "components/util/ExternalLink";
import { TachiConfig } from "lib/config";
import React from "react";
import { Alert } from "react-bootstrap";
import { Link } from "react-router-dom";
export default function FervidexPage() {
useSetSubheader(["Import Scores", "Fervidex"]);
@@ -52,6 +54,17 @@ export default function FervidexPage() {
</ul>
<li>That's it! Your scores should now automatically submit to the server.</li>
</ol>
<Alert variant="warning">
Looking to import existing scores? Import from your network first. If that's not
possible, enable "Sync Existing Scores" in{" "}
<Link
className="gentle-link"
to={"/u/me/integrations/services/fervidex"}
style={{ color: "black", textDecoration: "underline" }}
>
<b>your settings.</b>
</Link>
</Alert>
</div>
);
}
@@ -103,6 +103,25 @@ function ParseFunction(data: string) {
throw new Error(`This CSV has no scores? Only found headers.`);
}
// check for nonsense non-zero EX stuff with zero judgements
for (const line of lines) {
const cells = line.split(",");
for (let i = 0; i < 5; i++) {
const di = 5 + i * 7;
const exscore = cells[di + 1]!;
const pgreat = cells[di + 2]!;
const great = cells[di + 3]!;
if (Number(exscore) && Number(pgreat) === 0 && Number(great) === 0) {
throw new Error(
`Invalid CSV. This CSV does not have PGREAT/GREAT information, which we use to sanity check scores. If this is from Fervidex you can enable "Sync Existing Scores" and boot the game instead.`
);
}
}
}
const linesWithScores = lines.filter((e) => e !== "");
return {
@@ -91,7 +91,7 @@ function FervidexForm({
onChange={(e) => {
setFormSettings({ ...formSettings, forceStaticImport: e.target.checked });
}}
label="Force Static Imports"
label="Sync Existing Scores"
/>
<Form.Text>
Import existing scores on game load for non-INFINITAS IIDX versions.
@@ -81,7 +81,7 @@ function KsHookSV6CForm({
onChange={(e) => {
setFormSettings({ ...formSettings, forceStaticImport: e.target.checked });
}}
label="Force Static Imports"
label="Sync Existing Scores"
/>
<Form.Text>
Import existing scores on game load.