Skip to content

Commit

Permalink
NRPT-129: Fix offense string and fix database. (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
marklise authored Jun 4, 2020
1 parent 4e56f96 commit 022ab4d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion angular/projects/common/src/app/utils/record-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ export class Picklists {
},
'Oil and Gas Activities Act': {
'63': {
description: 'Penalty for failure to compluy with the Act or associated regulations'
description: 'Penalty for failure to comply with the Act or associated regulations'
}
}
},
Expand Down
38 changes: 38 additions & 0 deletions api/migrations/20200604205752-fixOffense.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
'use strict'

var dbm
var type
var seed

const badString = "Penalty for failure to compluy with the Act or associated regulations"
const goodString = "Penalty for failure to comply with the Act or associated regulations"

/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
dbm = options.dbmigrate
type = dbm.dataType
seed = seedLink
};

exports.up = async function(db) {
const mClient = await db.connection.connect(db.connectionString, { native_parser: true })
try {
const nrptiCollection = await mClient.collection('nrpti')
await nrptiCollection.updateMany({offence: badString}, { $set: { offence: goodString } })
mClient.close()
} catch (e) {
console.log('Error', e)
mClient.close()
}
}

exports.down = function(db) {
return null
}

exports._meta = {
"version": 1
}

0 comments on commit 022ab4d

Please sign in to comment.