Skip to content

Commit

Permalink
Pacific Power download progress (data bugged on frontend)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-egge committed Feb 5, 2024
1 parent 67f6c26 commit 41fc45c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 26 additions & 2 deletions backend/dependencies/nodejs/models/meter.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ class Meter {
}

async download(point, startTime, endTime, meterClass) {
console.log("\n\n***\nDownloading: \n")
console.log("\n\npoint: ", point)
console.log("\n\nstartTime: ", startTime)
console.log("\n\nendTime: ", endTime)
console.log("\n\nmeterClass: ", meterClass)

await DB.connect()
if (Object.values(meterClasses[meterClass]).includes(point)) {
// Generalized Meter Types
Expand All @@ -157,8 +163,7 @@ class Meter {
)
}

// may have to modify the below to be else-if, if we are going to have multiple custom webscraper tables (Solar_Meters, etc)
else {
else if (meter_table_name === 'Solar_Meters') {
return DB.query(
'SELECT ' +
point +
Expand All @@ -170,6 +175,25 @@ class Meter {
[startTime, endTime, this.id]
)
}

// pacific power meters, may need to change to else-if if there are going to be more custom classes starting with 999
else {
console.log("\n\nPacific power meter: " + this.id + "\n\n")

try {
let [{ pacific_power_id: pp_id }] = await DB.query('SELECT pacific_power_id FROM meters WHERE id = ?', [this.id])
return DB.query(
'SELECT ' +
point +
", time_seconds AS time FROM pacific_power_data WHERE time_seconds >= ? AND time_seconds <= ? AND pacific_power_meter_id = ?",
[startTime, endTime, pp_id]
)

} catch (error) {
console.error("Error executing Pacific power meter query:", error);
throw error; // Rethrow the error to handle it at the higher level or log it appropriately.
}
}
}
// Aquisuites
return DB.query(
Expand Down
4 changes: 4 additions & 0 deletions src/store/chart.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const actions = {

let data = await this.dispatch(store.getters.meterGroupPath + '/getData', reqPayload)

console.log("Data is: ", data)

Check failure on line 49 in src/store/chart.module.js

View workflow job for this annotation

GitHub Actions / Build / Deploy to S3 Test Build

Strings must use singlequote

let colorPayload = store.getters.color

if (reqPayload.color) {
Expand All @@ -66,6 +68,8 @@ const actions = {

await chartModifier.postGetData(chartData, reqPayload, this, store)

console.log("Chart Data is: ", chartData)

Check failure on line 71 in src/store/chart.module.js

View workflow job for this annotation

GitHub Actions / Build / Deploy to S3 Test Build

Strings must use singlequote

return chartData
},

Expand Down

0 comments on commit 41fc45c

Please sign in to comment.