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

Feature/add sort date to assigned #462

Merged
merged 8 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
francisli marked this conversation as resolved.
Show resolved Hide resolved
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;
}
Loading