Skip to content

Commit

Permalink
[Braydon & Carolyn] Fix CSV convert issue when note or other fields h…
Browse files Browse the repository at this point in the history
…ave a comma (#188)

* added escape character to csv converter

Co-authored-by: carolyn.zhang18@gmail.com <carolyn.zhang18@gmail.com>

* add double quotes for all string fields

---------

Co-authored-by: carolyn.zhang18@gmail.com <carolyn.zhang18@gmail.com>
  • Loading branch information
braydonwang and carolynzhang18 authored Nov 5, 2023
1 parent 200f4de commit 4905d93
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/helper/CSVConverter.tsx
Original file line number Diff line number Diff line change
@@ -4,12 +4,12 @@ import { CSVLog } from "../types/CSVLog";
const convertToCSVLog = (logRecord: LogRecord): CSVLog => {
return {
attnTo: logRecord.attnTo != null ? `${logRecord.attnTo.firstName} ${logRecord.attnTo.lastName}` : "",
building: logRecord.building,
datetime: logRecord.datetime,
employee: `${logRecord.employee.firstName} ${logRecord.employee.lastName}`,
building: `"${logRecord.building}"`,
datetime: `"${logRecord.datetime}"`,
employee: `"${logRecord.employee.firstName} ${logRecord.employee.lastName}"`,
flagged: logRecord.flagged,
note: logRecord.note,
residentId: logRecord.residentId,
note: `"${logRecord.note}"`,
residentId: `"${logRecord.residentId}"`,
tags: logRecord.tags != null ? logRecord.tags.join("; ") : "",
};
};

0 comments on commit 4905d93

Please sign in to comment.