Skip to content

Commit

Permalink
Merge branch 'main' into fix-extra-trial
Browse files Browse the repository at this point in the history
  • Loading branch information
katconnors authored Dec 21, 2024
2 parents ed44f53 + f25a333 commit 4b4d96a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 12 deletions.
7 changes: 7 additions & 0 deletions src/backend/db/migrations/4_add-created-at-on-tasks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Each task should have a created_at date so that we can sort by assigned date
-- NOTE: This relies on the assigned date never changing; if the app allows changes, we will likely want create a dedicated assigned_on date in addition to (or instead of) this column
ALTER TABLE task
ADD COLUMN created_at TIMESTAMPTZ NOT NULL DEFAULT NOW();

-- Add index to allow easy queries of tasks by date
CREATE INDEX idx_created_at ON task(created_at);
30 changes: 30 additions & 0 deletions src/backend/db/zapatos/schema.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/backend/routers/para.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const para = router({
"task.due_date",
"task.seen",
"task.trial_count",
"task.created_at",

eb
.selectFrom("trial_data")
Expand Down
16 changes: 5 additions & 11 deletions src/pages/benchmarks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,9 @@ function Benchmarks() {
<FilterAlt /> Filter <KeyboardArrowDown />
</span>

{
// TODO: replace simple sort pill w/this sort pill placeholder
/*
TODO: replace simple sort pill w/this sort pill placeholder
Sort Pill Placeholder
<span
{/* simple sort pill POC (TODO: add `<KeyboardArrowDown/>` if dropdown needed) */}
<button
onClick={() => handleSort("created_at")}
className={`${$button.pilled}`}
style={{
display: "flex",
Expand All @@ -137,10 +133,8 @@ function Benchmarks() {
gap: "4px",
}}
>
<Sort /> Sort <KeyboardArrowDown />
</span>
*/
}
<Sort /> Sort by date
</button>

{/* simple sort pill POC (see TODO above) */}
<button
Expand Down
3 changes: 2 additions & 1 deletion src/types/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type Benchmark = SelectableForTable<"benchmark">;
export type ChangeEvent = React.ChangeEvent<HTMLInputElement>;
export type FormEvent = React.FormEvent<HTMLFormElement>;

export type SortProperty = "first_name";
export type SortProperty = "first_name" | "created_at";
export type SortDirection = "asc" | "desc";

export interface TaskData {
Expand All @@ -21,4 +21,5 @@ export interface TaskData {
trial_count: number | null;
seen: boolean;
completed_trials: string | number | bigint | null;
created_at: Date;
}

0 comments on commit 4b4d96a

Please sign in to comment.