Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create mechanism for "completing" projects #93

Merged
merged 5 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 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 @@ -136,6 +137,9 @@ function applyFixes(data: SpadingData) {
data["source"] = "Unknown";
}

const project = projects.find(({ name }) => name === data._PROJECT);
horrible-little-slime marked this conversation as resolved.
Show resolved Hide resolved
if (project?.completed) return null;

return data;
}

Expand Down