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

Ticket #199 and ticket #213 #228

Merged
merged 32 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a185a10
Start to create view state for Edit view for individual student. Add …
BrettEastman Oct 9, 2023
9c436ed
Create tableBasic file, layout based on current design. Add Stack to …
BrettEastman Oct 12, 2023
c3523c3
Change tableBasic to EditStudentTable. Add style to MUI components vi…
BrettEastman Oct 17, 2023
458e3bb
Replace TableCell with Input in EditStudentTable. Import student obje…
BrettEastman Oct 19, 2023
73b9d13
Refactor EditStudentTable - remove row logic and make into separate c…
BrettEastman Oct 19, 2023
4f0c56a
refactor editStudent authenticated procedure
BeeSeeWhy Oct 20, 2023
6b7f22a
Change Input to Textfield in EditStudentRow. Remove Box due to div er…
BrettEastman Oct 20, 2023
757e968
Refactor editStudent authenticated procedure.
BrettEastman Oct 20, 2023
b2596f0
Refactor editStudent authenticated procedure - currently working. Ref…
BrettEastman Oct 24, 2023
a676745
styling of buttons
BeeSeeWhy Oct 26, 2023
723e0f6
Refactor Edit Student view state to have each EditStudentRow to be in…
BrettEastman Oct 26, 2023
116b38e
Fix(para-email invitation): remove student's name from the email temp…
BrettEastman Oct 27, 2023
ba99cf1
Refactor EditStudentRow to use input tag rather than Textfield. Apply…
BrettEastman Oct 27, 2023
34cd334
Add flex alignItems center to Stack component on student page to cent…
BrettEastman Oct 31, 2023
ce30da7
Add Stack to display without IEP to correct CSS change from last comm…
BrettEastman Oct 31, 2023
cfe22eb
Remove comment from case_manager.ts above editStudent. Add descriptio…
BrettEastman Nov 2, 2023
c4de851
Start to create view state for Edit view for individual student. Add …
BrettEastman Oct 9, 2023
75ab939
Create tableBasic file, layout based on current design. Add Stack to …
BrettEastman Oct 12, 2023
ca1a3b5
Change tableBasic to EditStudentTable. Add style to MUI components vi…
BrettEastman Oct 17, 2023
a6264c5
Replace TableCell with Input in EditStudentTable. Import student obje…
BrettEastman Oct 19, 2023
eaa8655
Refactor EditStudentTable - remove row logic and make into separate c…
BrettEastman Oct 19, 2023
57e79c4
refactor editStudent authenticated procedure
BeeSeeWhy Oct 20, 2023
6adc8eb
Change Input to Textfield in EditStudentRow. Remove Box due to div er…
BrettEastman Oct 20, 2023
20a1bb1
Refactor editStudent authenticated procedure.
BrettEastman Oct 20, 2023
176218b
Refactor editStudent authenticated procedure - currently working. Ref…
BrettEastman Oct 24, 2023
8f0c06d
Refactor Edit Student view state to have each EditStudentRow to be in…
BrettEastman Oct 26, 2023
535b7bc
Revert "Add Stack to display without IEP to correct CSS change from l…
BeeSeeWhy Nov 1, 2023
35f898d
Fix: Add invalidation to editMutation trpc query to refactor refetch …
BrettEastman Nov 2, 2023
51c02e7
Refactor Student Edit page to use form on student_id.tsx rather than …
BrettEastman Nov 3, 2023
79b8d3c
Fix save button in Edit view - add id to form and form attribute to b…
BrettEastman Nov 3, 2023
27ec481
Add .studentEditContainer and .editForm to the StudentPage.module.css…
BrettEastman Nov 3, 2023
478497f
Fix: remove duplicate editStudent procedure in case_manager.ts
BrettEastman Nov 7, 2023
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
42 changes: 42 additions & 0 deletions src/backend/routers/case_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,48 @@ export const case_manager = router({
.executeTakeFirstOrThrow();
}),

/**
* Edits the given student in the CM's roster. Throws an error if the student was not found in the db.
*/
editStudent: authenticatedProcedure
.input(
z.object({
student_id: z.string(),
first_name: z.string(),
last_name: z.string(),
email: z.string().email(),
grade: z.number(),
})
)
.mutation(async (req) => {
const { student_id, first_name, last_name, email, grade } = req.input;
const { userId } = req.ctx.auth; // case manager id

// Check if the student exists and if the case manager is assigned to the student
const existingStudent = req.ctx.db
.selectFrom("student")
.selectAll()
.where("student_id", "=", student_id)
.where("assigned_case_manager_id", "=", userId);

if (!existingStudent) {
throw new Error("Student not found");
}

// Update the student's information
return await req.ctx.db
.updateTable("student")
.set({
first_name,
last_name,
email: email.toLowerCase(),
grade,
})
.where("student_id", "=", student_id)
.returningAll()
.executeTakeFirstOrThrow();
}),

/**
* Removes the case manager associated with this student.
*/
Expand Down
8 changes: 5 additions & 3 deletions src/backend/routers/para.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export const para = router({
.selectAll()
.executeTakeFirst();

const caseManagerName = req.ctx.auth.session.user?.name ?? "";

if (!paraData) {
paraData = await req.ctx.db
.insertInto("user")
Expand All @@ -66,10 +68,10 @@ export const para = router({
to: email,
subject: "Para-professional email confirmation",
text: "Email confirmation",
html: "<h1>Email confirmation</h1><p>Please confirm your email by going to the following link: <a>no link yet</a></p>",
html: `<p>Dear ${first_name},</p><p>Welcome to the data collection team for SFUSD.EDU!</p><p>I am writing to invite you to join our data collection efforts for our students. We are using an online platform called <strong>Project Compass</strong> to track and monitor student progress, and your participation is crucial to the success of this initiative.</p><p>To access Project Compass and begin collecting data, please follow these steps:</p><ul><li>Go to the website: (<a href="https://staging.compassiep.com/">https://staging.compassiep.com/</a>)</li> <li>Login using your provided username and password</li><li>Once logged in, navigate to the dashboard where you would see the student goals page</li></ul><p>By clicking on the <strong>data collection</strong> button, you will be directed to the instructions outlining the necessary steps for data collection. Simply follow the provided instructions and enter the required data points accurately.</p><p>If you encounter any difficulties or have any questions, please feel free to reach out to me. I am here to assist you throughout the process and ensure a smooth data collection experience. Your dedication and contribution will make a meaningful impact on our students' educational journeys.</p><p>Thank you,</p><p>${caseManagerName}<br>Case Manager</p>`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐧 we can fix this later, but ideally the domain is pulled from the environment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sounds good. I'll leave it for now, but let me know.

});
// TODO: when site is deployed, add url to html above
// to do elsewhere: add "email_verified_at" timestamp when para first signs in with their email address (entered into db by cm)
// TODO: when site is deployed, add new url to html above
// TODO elsewhere: add "email_verified_at" timestamp when para first signs in with their email address (entered into db by cm)
}

return paraData;
Expand Down
2 changes: 2 additions & 0 deletions src/backend/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { TRPCError, initTRPC } from "@trpc/server";
import { createContext } from "./context";
import superjson from "superjson";

// initialize tRPC exactly once per application:
export const t = initTRPC.context<typeof createContext>().create({
// SuperJSON allows us to transparently use, e.g., standard Date/Map/Sets
// over the wire between the server and client.
Expand Down Expand Up @@ -34,6 +35,7 @@ const isAdmin = t.middleware(({ next, ctx }) => {
});
});

// Define and export the tRPC router
export const router = t.router;
export const authenticatedProcedure = t.procedure.use(isAuthenticated);
export const adminProcedure = t.procedure.use(isAuthenticated).use(isAdmin);
7 changes: 4 additions & 3 deletions src/components/iep/Iep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import $input from "@/styles/Input.module.css";
import Box from "@mui/material/Box";
import Container from "@mui/material/Container";
import List from "@mui/material/List";
import Stack from "@mui/material/Stack";
import Image from "next/image";
import noGoals from "../../public/img/no-goals-icon.png";
import $Iep from "./Iep.module.css";
import $Image from "../../styles/Image.module.css";
import $Iep from "./Iep.module.css";

interface IepProps {
iep_id: string;
Expand Down Expand Up @@ -42,7 +43,7 @@ const Iep = ({ iep_id }: IepProps) => {
}

return (
<>
<Stack sx={{ width: 1 }}>
<Container>
<Box className={$Iep.goalBox}>
<p className={$Iep.goalTab}>Goals &#40;{goals?.length ?? 0}&#41;</p>
Expand Down Expand Up @@ -104,7 +105,7 @@ const Iep = ({ iep_id }: IepProps) => {
</Box>
</Container>
)}
</>
</Stack>
);
};
export default Iep;
Loading
Loading