Skip to content

Commit

Permalink
Issue #27 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
csmig committed Oct 27, 2020
1 parent 5191f90 commit 62f58f0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions api/source/service/mysql/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,18 +419,16 @@ module.exports.updateStatsAssetStig = async function(connection, options) {
mediumCount = stats.mediumCount,
lowCount = stats.lowCount
`
console.log(`Connection ${connection.connection.connectionId} STATS SELECT`)
const [stats] = await connection.query(sqlSelect, binds)
console.log(`Connection ${connection.connection.connectionId} STATS UPDATE`)
const [result] = await connection.query(sqlUpdate, stats[0])
if (result.affectedRows == 0) {
console.log(`Connection ${connection.connection.connectionId} STATS INSERT`)
await connection.query(sqlInsert, stats[0])
if (stats.length > 0) {
const [result] = await connection.query(sqlUpdate, stats[0])
if (result.affectedRows == 0) {
await connection.query(sqlInsert, stats[0])
}
}
return true
}
catch (err) {
console.log(`Connection ${connection.connection.connectionId} STATS ERROR ${err.message}`)
throw err
}
}
Expand Down

0 comments on commit 62f58f0

Please sign in to comment.