fix: weird problem with GiveWell dates
This commit is contained in:
parent
927114a8cc
commit
752a5b2cfe
|
@ -324,7 +324,7 @@ export async function pgInsertIntoDashboard({ datum, schema, tableName }) {
|
||||||
creator text,
|
creator text,
|
||||||
extra json
|
extra json
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
pgInsertIntoDashboard({
|
pgInsertIntoDashboard({
|
||||||
datum: {
|
datum: {
|
||||||
title: "Test dashboard",
|
title: "Test dashboard",
|
||||||
|
@ -341,7 +341,7 @@ pgInsertIntoDashboard({
|
||||||
schema: "latest",
|
schema: "latest",
|
||||||
tableName: "dashboards",
|
tableName: "dashboards",
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
export async function pgUpsert({ contents, schema, tableName }) {
|
export async function pgUpsert({ contents, schema, tableName }) {
|
||||||
if (tableWhiteList.includes(`${schema}.${tableName}`)) {
|
if (tableWhiteList.includes(`${schema}.${tableName}`)) {
|
||||||
if (schema == "latest") {
|
if (schema == "latest") {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"probability": 0.75,
|
"probability": 0.75,
|
||||||
"type": "PROBABILITY"
|
"type": "PROBABILITY"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"timestamp": "2021-02-23T15∶21∶37.005Z",
|
"timestamp": "2021-02-23T15∶21∶37.005Z",
|
||||||
"qualityindicators": {
|
"qualityindicators": {
|
||||||
"stars": 2
|
"stars": 2
|
||||||
|
|
|
@ -23,7 +23,7 @@ async function fetchPage(url) {
|
||||||
|
|
||||||
/* Body */
|
/* Body */
|
||||||
|
|
||||||
async function main() {
|
async function main1() {
|
||||||
let rawdata = fs.readFileSync("./src/input/givewellopenphil-urls.txt");
|
let rawdata = fs.readFileSync("./src/input/givewellopenphil-urls.txt");
|
||||||
let data = rawdata
|
let data = rawdata
|
||||||
.toString()
|
.toString()
|
||||||
|
@ -64,7 +64,18 @@ async function main() {
|
||||||
}
|
}
|
||||||
// let string = JSON.stringify(results, null, 2)
|
// let string = JSON.stringify(results, null, 2)
|
||||||
// fs.writeFileSync('./data/givewell-questions-unprocessed.json', string);
|
// 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();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user