Skip to content

Commit

Permalink
fixes for placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigotiscareno committed Apr 7, 2024
1 parent 30a3cac commit be9d469
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
5 changes: 5 additions & 0 deletions backend/python/app/resources/visit_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ def __init__(self, **kwargs):
self.user_id = kwargs.get("user_id")
self.childInformation = kwargs.get("childInformation")
self.visitTimestamp = kwargs.get("visitTimestamp")
self.visit_supervision = kwargs.get("visit_supervision")
self.location = kwargs.get("location")
self.visit_day = kwargs.get("visit_day")
self.start_time = kwargs.get("start_time")
self.end_time = kwargs.get("end_time")
self.attendance = kwargs.get("attendance")
self.transportation = kwargs.get("transportation")
self.notes = kwargs.get("notes")
Expand Down
9 changes: 8 additions & 1 deletion backend/python/app/rest/visit_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ def create_visit():
"user_id": data.get("user_i_d"),
"childInformation": data.get("child_details"),
"visitTimestamp": data.get("visit_details", {}).get("visit_date"),
"location": data.get("visit_details", {}).get("location"),
"visit_day": data.get("visit_details", {}).get("visit_day"),
"visit_supervision": data.get("visit_details", {})
.get("visit_supervision")
.upper(),
"start_time": data.get("visit_details", {}).get("start_time"),
"end_time": data.get("visit_details", {}).get("end_time"),
"attendance": data.get("attendance_entries"),
"transportation": data.get("transportation_entries"),
"notes": "placeholder for notes", # TODO: data.get("notes"),
"notes": data.get("transportation_entries").get("entries")[0].get("notes"),
"childAndFamilySupportWorker": data.get("child_details", {}).get(
"child_service_worker"
),
Expand Down
11 changes: 5 additions & 6 deletions backend/python/app/services/implementations/visit_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def __init__(self, logger):
self.logger = logger

def create_visit(self, visit: VisitDTO):
print(visit.__dict__, "visit")
try:
attendance_sheet = AttendanceSheets(
family_name=visit.childInformation["family_name"],
Expand All @@ -25,11 +24,11 @@ def create_visit(self, visit: VisitDTO):
attendance_record = AttendanceRecords(
attendance_sheet_id=attendance_sheet.id,
visit_date=visit.visitTimestamp,
visit_day="visit_day_placeholder",
visit_supervision="PARTIAL",
start_time="start_time_placeholder",
end_time="end_time_placeholder",
location=visit.notes,
visit_day=visit.visit_day,
visit_supervision=visit.visit_supervision,
start_time=visit.start_time,
end_time=visit.end_time,
location=visit.location,
notes=visit.notes,
)
db.session.add(attendance_record)
Expand Down
1 change: 1 addition & 0 deletions frontend/src/APIClients/VisitAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface Visit {
gaurdian: string;
name: string;
duration: string;
notes: string;
}[];
}

Expand Down
15 changes: 15 additions & 0 deletions frontend/src/components/pages/VisitPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ const Visit = (): React.ReactElement => {
const { caseId } = useParams<{ caseId: string}>();
const caseNumber: number = parseInt(caseId, 10);

const [visitNotes, setVisitNotes] = useState('');

const handleNotesChange = (note: string) => {
let updatedEntries = [...transportationEntries.entries];

Check failure on line 30 in frontend/src/components/pages/VisitPage.tsx

View workflow job for this annotation

GitHub Actions / run-lint

'updatedEntries' is never reassigned. Use 'const' instead

Check failure on line 30 in frontend/src/components/pages/VisitPage.tsx

View workflow job for this annotation

GitHub Actions / run-lint

'transportationEntries' was used before it was defined

if (updatedEntries.length > 0) {
updatedEntries[0] = { ...updatedEntries[0], notes: note };
}

setTransportationEntries({ ...transportationEntries, entries: updatedEntries });

Check failure on line 36 in frontend/src/components/pages/VisitPage.tsx

View workflow job for this annotation

GitHub Actions / run-lint

'setTransportationEntries' was used before it was defined

Check failure on line 36 in frontend/src/components/pages/VisitPage.tsx

View workflow job for this annotation

GitHub Actions / run-lint

'transportationEntries' was used before it was defined
};

const DEFAULT_CHILD_DETAILS = {
familyName: "",
children: [],
Expand Down Expand Up @@ -66,6 +78,7 @@ const Visit = (): React.ReactElement => {
gaurdian: "",
name: "",
duration: "",
notes: "",
},
],
};
Expand Down Expand Up @@ -228,6 +241,8 @@ const Visit = (): React.ReactElement => {
placeholder="Note any additional information in regards to this visit."
height="10rem"
paddingBottom="7rem"
value={visitNotes}
onChange={handleNotesChange}
/>
</Box>
<Text textStyle="header-medium" id="childFamilySupportWorker">
Expand Down

0 comments on commit be9d469

Please sign in to comment.