From e9f0c66ca22094e4e606e3e9ae5a7b52dd65e307 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 30 Mar 2022 22:02:52 -0400 Subject: [PATCH] tweak: only show first three options of sample when inserting --- src/backend/database/pg-wrapper.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/backend/database/pg-wrapper.ts b/src/backend/database/pg-wrapper.ts index 0b21c9b..b762da9 100644 --- a/src/backend/database/pg-wrapper.ts +++ b/src/backend/database/pg-wrapper.ts @@ -573,7 +573,21 @@ export async function pgUpsert({ contents, schema, tableName }) { ); console.log("Sample: "); - console.log(JSON.stringify(contents.slice(0, 1), null, 4)); + console.log( + JSON.stringify( + // only show the first three options + contents.slice(0, 1).map((question) => ({ + ...question, + options: question.options + ? question.options.length > 3 + ? question.options.slice(0, 3).concat("...") + : question.options + : null, + })), + null, + 4 + ) + ); await client.query("COMMIT"); } catch (e) { await client.query("ROLLBACK");