Not really sure what is going on, have not done a commit in a while.
I assume this is all the metric tracking changes. Looks like some script changes as well.
This commit is contained in:
1 parent
48c1fa8e69
commit
39e153b8e1
15 files changed
+303
-1480
No files matched your search
@@ -2,7 +2,7 @@ let db = require('@config/database')
|
||||
|
||||
let Note = require('@models/Note')
|
||||
|
||||
let MetricTracking = module.exports = {}
|
||||
let MetricTracking = module.exports = {};
|
||||
|
||||
|
||||
MetricTracking.get = (userId, masterKey) => {
|
||||
@@ -23,31 +23,36 @@ MetricTracking.get = (userId, masterKey) => {
|
||||
})
|
||||
|
||||
} else {
|
||||
//Or create a new note
|
||||
let finalId = null
|
||||
return Note.create(userId, 'Metric Tracking', '', masterKey)
|
||||
.then(insertedId => {
|
||||
finalId = insertedId
|
||||
db.promise().query('UPDATE note SET quick_note = 2 WHERE id = ? AND user_id = ?',[insertedId, userId])
|
||||
.then((rows, fields) => {
|
||||
|
||||
const note = Note.get(userId, finalId, masterKey)
|
||||
.then(noteData => {
|
||||
return resolve(noteData)
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
return resolve('no data')
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.catch(console.log)
|
||||
})
|
||||
}
|
||||
|
||||
MetricTracking.save = (userId, cycleData, masterKey) => {
|
||||
MetricTracking.create = (userId, masterKey) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let finalId = null
|
||||
return Note.create(userId, 'Metric Tracking', '', masterKey)
|
||||
.then(insertedId => {
|
||||
finalId = insertedId
|
||||
db.promise().query('UPDATE note SET quick_note = 2 WHERE id = ? AND user_id = ?',[insertedId, userId])
|
||||
.then((rows, fields) => {
|
||||
|
||||
const note = Note.get(userId, finalId, masterKey)
|
||||
.then(noteData => {
|
||||
return resolve(noteData)
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
.catch(console.log)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
MetricTracking.save = (userId, metricData, masterKey) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
let finalId = null
|
||||
@@ -55,7 +60,7 @@ MetricTracking.save = (userId, cycleData, masterKey) => {
|
||||
MetricTracking.get(userId, masterKey)
|
||||
.then(noteObject => {
|
||||
|
||||
return Note.update(userId, noteObject.id, cycleData, noteObject.title, noteObject.color, noteObject.pinned, noteObject.archived, null, masterKey)
|
||||
return Note.update(userId, noteObject.id, metricData, noteObject.title, noteObject.color, noteObject.pinned, noteObject.archived, null, masterKey)
|
||||
|
||||
})
|
||||
.then( saveResults => {
|
||||
|
||||
Reference in new issue
Block a user