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

Commit 21e9bcb7 by Mick Hansen

cleanup

1 parent 99b15f17
Showing with 4 additions and 18 deletions
...@@ -257,10 +257,9 @@ module.exports = (function() { ...@@ -257,10 +257,9 @@ module.exports = (function() {
} }
var self = this 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) , updatedAtAttr = Utils._.underscoredIf(this.__options.updatedAt, this.__options.underscored)
, createdAtAttr = Utils._.underscoredIf(this.__options.createdAt, this.__options.underscored) , createdAtAttr = Utils._.underscoredIf(this.__options.createdAt, this.__options.underscored)
, originalValues = Utils._.clone(this.dataValues)
if (options.fields) { if (options.fields) {
if (self.__options.timestamps) { if (self.__options.timestamps) {
...@@ -278,11 +277,9 @@ module.exports = (function() { ...@@ -278,11 +277,9 @@ module.exports = (function() {
self.hookValidate().error(function(err) { self.hookValidate().error(function(err) {
emitter.emit('error', err) emitter.emit('error', err)
}).success(function() { }).success(function() {
var tmpVals = self.dataValues
options.fields.forEach(function(field) { options.fields.forEach(function(field) {
if (tmpVals[field] !== undefined) { if (self.dataValues[field] !== undefined) {
values[field] = tmpVals[field] values[field] = self.dataValues[field]
} }
}) })
...@@ -360,18 +357,7 @@ module.exports = (function() { ...@@ -360,18 +357,7 @@ module.exports = (function() {
return emitter.emit('error', err) return emitter.emit('error', err)
} }
// redeclare our new values args[2] = values = newValues || values
values = newValues || values
/*tmpVals = values
values = {}
options.fields.forEach(function(field) {
if (tmpVals[field] !== undefined) {
values[field] = tmpVals[field]
}
})*/
args[2] = values
// Newest values need to be on the dao since the dao is returned from the query interface // Newest values need to be on the dao since the dao is returned from the query interface
self.dataValues = _.extend(self.dataValues, values) 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!