不要怂,就是干,撸起袖子干!

Commit 21e9bcb7 by Mick Hansen

cleanup

1 parent 99b15f17
Showing with 4 additions and 18 deletions
......@@ -257,10 +257,9 @@ module.exports = (function() {
}
var self = this
, values = options.fields ? {} : (this.options.includeNames ? _.omit(this.dataValues, this.options.includeNames) : this.dataValues)
, values = options.fields
, updatedAtAttr = Utils._.underscoredIf(this.__options.updatedAt, this.__options.underscored)
, createdAtAttr = Utils._.underscoredIf(this.__options.createdAt, this.__options.underscored)
, originalValues = Utils._.clone(this.dataValues)
if (options.fields) {
if (self.__options.timestamps) {
......@@ -278,11 +277,9 @@ module.exports = (function() {
self.hookValidate().error(function(err) {
emitter.emit('error', err)
}).success(function() {
var tmpVals = self.dataValues
options.fields.forEach(function(field) {
if (tmpVals[field] !== undefined) {
values[field] = tmpVals[field]
if (self.dataValues[field] !== undefined) {
values[field] = self.dataValues[field]
}
})
......@@ -360,18 +357,7 @@ module.exports = (function() {
return emitter.emit('error', err)
}
// redeclare our new values
values = newValues || values
/*tmpVals = values
values = {}
options.fields.forEach(function(field) {
if (tmpVals[field] !== undefined) {
values[field] = tmpVals[field]
}
})*/
args[2] = values
args[2] = values = newValues || values
// Newest values need to be on the dao since the dao is returned from the query interface
self.dataValues = _.extend(self.dataValues, values)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!