Skip to content

Commit 532b421

Browse files
committed
Fix devpost import
1 parent 90e8ecb commit 532b421

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

src/util/actions/devpost.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,26 @@ async function actionImportProjects(
151151

152152
const result: ImportResult = { imported: 0, warnings: [], errors: [] };
153153

154-
const parsed = Papa.parse<Record<string, string>>(csvText, {
154+
// This is a hack, since Devpost puts in the first additional team member as a header
155+
// and leaves the rest as "...".
156+
// This just fixes the header so it includes up to a certain number of team member columns.
157+
// The 5 is completely arbitrary.
158+
const csvParts = csvText.split("\n");
159+
csvParts[0] = csvParts[0].replace(
160+
/,\.\.\.$/,
161+
"," +
162+
Array(5)
163+
.fill("")
164+
.map(
165+
(_, idx) =>
166+
`Team Member ${idx + 2} First Name,Team Member ${idx + 2} Last Name,Team Member ${idx + 2} Email`,
167+
)
168+
.join(","),
169+
);
170+
console.log(csvParts[0]);
171+
const fixedCSVText = csvParts.join("\n");
172+
173+
const parsed = Papa.parse<Record<string, string>>(fixedCSVText, {
155174
header: true,
156175
skipEmptyLines: true,
157176
});

0 commit comments

Comments
 (0)