Skip to content

Commit

Permalink
Merge pull request #93 from loathers/complete-kiwi
Browse files Browse the repository at this point in the history
create mechanism for "completing" projects
  • Loading branch information
horrible-little-slime committed Jun 20, 2024
2 parents 1dd3322 + e1a00e6 commit 6238579
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/excavator-projects/projects/miniKiwi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ export const MINI_KIWI: ExcavatorProject = {
COMBAT_ROUND: spadeKiwi,
},
since: 27973, // mini kiwi familiar equipment added
completed: true,
};
1 change: 1 addition & 0 deletions packages/excavator-projects/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export type ExcavatorProject = {
author: string;
hooks: Partial<Hooks>;
since?: number;
completed?: boolean;
};
5 changes: 4 additions & 1 deletion packages/excavator-script/src/excavator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ type Event = keyof ExcavatorProject["hooks"];

function main(event: Event, meta: string, page: string) {
projects
.filter(({ hooks, since = 0 }) => event in hooks && since <= getRevision())
.filter(
({ hooks, since = 0, completed }) =>
!completed && event in hooks && since <= getRevision(),
)
.map(({ name, hooks }) => [name, hooks[event]!(meta, page)] as const)
.filter(tupleNotNull)
.forEach(([name, data]) => {
Expand Down
5 changes: 5 additions & 0 deletions packages/excavator-web/app/routes/projects.$project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export default function Project() {
return (
<Stack spacing={8} mt={8}>
<ProjectHeader project={project} projects={projectNames} />
{project.completed && (
<Alert>
This project is completed. It is no longer accepting data.
</Alert>
)}
{data.length === 0 ? (
<Alert>No data for this project yet - you better get excavating!</Alert>
) : (
Expand Down
5 changes: 5 additions & 0 deletions packages/excavator-web/etl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PrismaClient } from "@prisma/client";
import "dotenv/config";
import { projects } from "excavator-projects";
import makeFetchCookie from "fetch-cookie";
import crypto from "node:crypto";

Expand Down Expand Up @@ -113,6 +114,10 @@ function applyFixes(data: SpadingData) {
if (data._PROJECT === "Fresh Coat Of Paint")
data._PROJECT = "Fresh Coat of Paint";

// 24-06-20: Some projects are "completed"
const project = projects.find(({ name }) => name === data._PROJECT);
if (project?.completed) return null;

// 2024-04-02: Accidentally zero-indexed this item count
if (data._PROJECT === "Continental Juice Bar" && "item0" in data) {
data["item3"] = data["item2"];
Expand Down

0 comments on commit 6238579

Please sign in to comment.