fix(postgres): Geopoint issue #3285 (#3874)

This commit is contained in:
Diamond Lewis
2017-05-28 11:41:09 -05:00
committed by Florent Vilmart
parent d149d16fce
commit a380fcf2c7
2 changed files with 20 additions and 1 deletions

View File

@@ -26,6 +26,25 @@ describe('Parse.GeoPoint testing', () => {
});
});
it('update geopoint', (done) => {
const oldPoint = new Parse.GeoPoint(44.0, -11.0);
const newPoint = new Parse.GeoPoint(24.0, 19.0);
const obj = new TestObject();
obj.set('location', oldPoint);
obj.save().then(() => {
obj.set('location', newPoint);
return obj.save();
}).then(() => {
var query = new Parse.Query(TestObject);
return query.get(obj.id);
}).then((result) => {
const point = result.get('location');
equal(point.latitude, newPoint.latitude);
equal(point.longitude, newPoint.longitude);
done();
});
});
it('has the correct __type field in the json response', done => {
var point = new Parse.GeoPoint(44.0, -11.0);
var obj = new TestObject();

View File

@@ -920,7 +920,7 @@ export class PostgresStorageAdapter {
index += 2;
} else if (fieldValue.__type === 'GeoPoint') {
updatePatterns.push(`$${index}:name = POINT($${index + 1}, $${index + 2})`);
values.push(fieldName, fieldValue.latitude, fieldValue.longitude);
values.push(fieldName, fieldValue.longitude, fieldValue.latitude);
index += 3;
} else if (fieldValue.__type === 'Relation') {
// noop