-
Notifications
You must be signed in to change notification settings - Fork 14
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
MVP data models for goals, subgoals(benchmarks), tasks. #157
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't speak much to the data model but implementation is looking pretty good :)
@@ -70,12 +71,44 @@ CREATE TABLE "goal" ( | |||
goal_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), -- TODO: add index to allow reordering | |||
iep_id UUID REFERENCES "iep" (iep_id), | |||
description TEXT NOT NULL, | |||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | |||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | |||
category TEXT NOT NULL CHECK (category IN ('writing', 'reading', 'math', 'other')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐧 convention has been to have "common" columns like created_at
at the end of the table definition
); | ||
|
||
CREATE TABLE "subgoal" ( | ||
subgoal_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), -- TODO: add index to allow reordering | ||
goal_id UUID REFERENCES "goal" (goal_id), | ||
description TEXT NOT NULL, | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | ||
instructions TEXT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐧 I'd probably make this not null and default to ""
|
||
-- Optional depending on type of task | ||
notes TEXT, | ||
image_list TEXT[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't look like this is being used yet so I might remove it
this should point to file_id
s, it's usually a bit of an antipattern to store arrays in sql
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I was thinking of having files reference trials, but kind of left it here as a placeholder since it wasn't essential yet. I'll remove it for now.
<form onSubmit={onSubmit} id="table_input_form"></form> | ||
<form | ||
onSubmit={(event: React.FormEvent<HTMLFormElement>) => { | ||
onSubmit(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type for onSubmit
should be updated above to return Promise<void> | void
and then we can await it here to prevent resetting the form if onSubmit
is async and throws
const form = document.getElementById("table_input_form"); | ||
(form as HTMLFormElement).reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const form = document.getElementById("table_input_form"); | |
(form as HTMLFormElement).reset(); | |
event.target.reset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I was playing around with this for Tessa's issue and forgot to remove it. But thank you for this optimization! I'll let Tessa know about it.
@@ -45,7 +45,8 @@ CREATE TABLE "student" ( | |||
first_name TEXT NOT NULL, | |||
last_name TEXT NOT NULL, | |||
email TEXT NOT NULL UNIQUE, | |||
assigned_case_manager_id UUID REFERENCES "user" (user_id) ON DELETE SET NULL | |||
assigned_case_manager_id UUID REFERENCES "user" (user_id) ON DELETE SET NULL, | |||
grade SMALLINT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newest mockups have grade on the student table and on students' pages. Although I forgot to implement it elsewhere. I can either a) remove it for now and let another issue handle it or b) write a todo comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, try to keep a PR self contained that is focused on a specific feature/bug. This field would ideally be in the PR that adds that to the frontend/backend, but since you have already added it here, I will leave it to your discretion if you want to leave it in or remove it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Sometimes I think of something and just toss it in, but I'll try to keep things more self contained from now on.
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | ||
); | ||
|
||
CREATE TABLE "subgoal" ( | ||
subgoal_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), -- TODO: add index to allow reordering | ||
goal_id UUID REFERENCES "goal" (goal_id), | ||
description TEXT NOT NULL, | ||
instructions TEXT NOT NULL DEFAULT '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instructions TEXT NOT NULL DEFAULT '', | |
instructions TEXT NOT NULL DEFAULT "", |
Consistent quotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this first, and found out that in SQL, single and double quotes actually have different meanings. Single quotes are for string literals, while double quotes are "delimited identifiers", meaning they reference tables or columns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - thanks for the info. TIL
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | ||
); | ||
|
||
CREATE TABLE "subgoal" ( | ||
subgoal_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), -- TODO: add index to allow reordering | ||
goal_id UUID REFERENCES "goal" (goal_id), | ||
description TEXT NOT NULL, | ||
instructions TEXT NOT NULL DEFAULT '', | ||
target_max_attempts INTEGER, --How many "questions" to administer in a single sitting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on the type of subgoal this is - e.g. quantitative vs behavioral.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's one reason I left it as an optional column. But I believe we discussed with Niko that our MVP would focus on one collection type, with plans to add more in the future. Maybe we can brainstorm better options for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG. Let's get this PR merged in, and we can update it later.
@@ -32,4 +42,13 @@ test("basic flow - add/get goals and subgoals", async (t) => { | |||
goal_id: goal1!.goal_id, | |||
}); | |||
t.is(gotSubgoals.length, 2); | |||
|
|||
t.truthy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐧 Ideally, we should be using our API methods instead of directly querying the db. We will likely need a getTasks
method down the line when we want to do the Para schedule view. You can add a TODO for that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* New task and data tables * Added task and data tables. Edited paraDash and taskCards to use db * Updated schemas * Updated all paratrial schemas. Updated routes and components to reflect changes. * Added new tests for para routes, adjusted test for iep route * Adjusted schemas, removed unrelated code. * Add todos in iep.test
#90 :
Worked with: @amantri @tessathornberry @hieungo89