Skip to content

Commit

Permalink
create mechanism for "completing" projects
Browse files Browse the repository at this point in the history
  • Loading branch information
horrible-little-slime committed Jun 20, 2024
1 parent 1dd3322 commit fe1d1f6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
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
1 change: 1 addition & 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,7 @@ 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 @@ -163,6 +164,9 @@ async function main() {

const { _PROJECT, _VERSION, ...data } = fixed;

if (projects.find((project) => project.name === _PROJECT)?.completed)
continue;

const id = Number(kmail.id);

await prisma.spadingData.upsert({
Expand Down

0 comments on commit fe1d1f6

Please sign in to comment.