fix: weird problem with GiveWell dates

This commit is contained in:
NunoSempere 2022-02-14 15:39:30 -05:00
parent 927114a8cc
commit 752a5b2cfe
3 changed files with 18 additions and 7 deletions

View File

@ -324,7 +324,7 @@ export async function pgInsertIntoDashboard({ datum, schema, tableName }) {
creator text,
extra json
*/
/*
pgInsertIntoDashboard({
datum: {
title: "Test dashboard",
@ -341,7 +341,7 @@ pgInsertIntoDashboard({
schema: "latest",
tableName: "dashboards",
});
*/
export async function pgUpsert({ contents, schema, tableName }) {
if (tableWhiteList.includes(`${schema}.${tableName}`)) {
if (schema == "latest") {

View File

@ -23,7 +23,7 @@ async function fetchPage(url) {
/* Body */
async function main() {
async function main1() {
let rawdata = fs.readFileSync("./src/input/givewellopenphil-urls.txt");
let data = rawdata
.toString()
@ -64,7 +64,18 @@ async function main() {
}
// let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/givewell-questions-unprocessed.json', string);
await databaseUpsert({ contents: results, group: "givewell-questions-unprocessed" });
await databaseUpsert({
contents: results,
group: "givewell-questions-unprocessed",
});
}
main();
// main1()
async function main2() {
let rawdata = fs.readFileSync("./src/input/givewellopenphil-questions.json");
let data = JSON.parse(rawdata);
let dataWithDate = data.map(datum => ({...datum, timestamp: '2021-02-23'}))
await databaseUpsert({ group: "givewellopenphil", contents: dataWithDate });
}
main2();