Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fixes #1359] multiple-column sort problem 修复多字段排序问题 #1410

Open
wants to merge 4 commits into
base: 0.11.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions lib/waterline/core/transformations.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Transformation.prototype.initialize = function(attributes, tables) {

// Set transformation attr to new key
if (key === 'columnName') {
if (attr === attributes[attr][key]) return;
// if (attr === attributes[attr][key]) return; // cjy37 del
self._transformations[attr] = attributes[attr][key];
}

Expand Down Expand Up @@ -103,8 +103,9 @@ Transformation.prototype.serialize = function(attributes, behavior) {
// Schema must be serialized in first level only
if (behavior === 'schema') {
if (hasOwnProperty(self._transformations, property)) {
obj[self._transformations[property]] = _.clone(obj[property]);
var tmpval = _.clone(obj[property]); // cjy37
delete obj[property];
obj[self._transformations[property]] = tmpval; // cjy37
}
return;
}
Expand All @@ -117,8 +118,9 @@ Transformation.prototype.serialize = function(attributes, behavior) {

// check if object key is in the transformations
if (hasOwnProperty(self._transformations, property)) {
obj[self._transformations[property]] = _.clone(obj[property]);
var tmpval = _.clone(obj[property]); // cjy37
delete obj[property];
obj[self._transformations[property]] = tmpval; // cjy37

return recursiveParse(obj[self._transformations[property]]);
}
Expand All @@ -129,8 +131,10 @@ Transformation.prototype.serialize = function(attributes, behavior) {
// Check if property is a transformation key
if (hasOwnProperty(self._transformations, property)) {

obj[self._transformations[property]] = obj[property];
var tmpval = obj[property]; // cjy37
delete obj[property];
obj[self._transformations[property]] = tmpval; // cjy37

}
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "waterline",
"description": "An ORM for Node.js and the Sails framework.",
"version": "0.11.11",
"version": "0.11.12",
"homepage": "http://waterlinejs.org",
"contributors": [
{
Expand Down