Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Always save record as planningalerts now does versioning

  • Loading branch information...
mlandauer committed May 8, 2019
1 parent 21929f5 commit e8d8609ee9467d1330ec558c9e7569567889e3a1
Showing with 5 additions and 11 deletions.
  1. +2 −5 scraper.js
  2. +1 −1 scraper.js.map
  3. +2 −5 scraper.ts

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -33,7 +33,7 @@ async function initializeDatabase() {

async function insertRow(database, developmentApplication) {
return new Promise((resolve, reject) => {
let sqlStatement = database.prepare("insert or ignore into [data] values (?, ?, ?, ?, ?, ?, ?, ?, ?)");
let sqlStatement = database.prepare("insert or replace into [data] values (?, ?, ?, ?, ?, ?, ?, ?, ?)");
sqlStatement.run([
developmentApplication.applicationNumber,
developmentApplication.address,
@@ -49,10 +49,7 @@ async function insertRow(database, developmentApplication) {
console.error(error);
reject(error);
} else {
if (this.changes > 0)
console.log(` Inserted: application \"${developmentApplication.applicationNumber}\" with address \"${developmentApplication.address}\" and reason \"${developmentApplication.reason}\" into the database.`);
else
console.log(` Skipped: application \"${developmentApplication.applicationNumber}\" with address \"${developmentApplication.address}\" and reason \"${developmentApplication.reason}\" because it was already present in the database.`);
console.log(` Saved: application \"${developmentApplication.applicationNumber}\" with address \"${developmentApplication.address}\" and reason \"${developmentApplication.reason}\" into the database.`);
sqlStatement.finalize(); // releases any locks
resolve(row);
}

0 comments on commit e8d8609

Please sign in to comment.
You can’t perform that action at this time.