Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
tibetsprague committed Jul 6, 2022
2 parents 2856888 + c31e383 commit e39e07b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [4.1.5] - 2022-07-05

### Fixed
- Saving of groups with empty group shapes

## [4.1.4] - 2022-06-20

### Fixed
Expand Down
20 changes: 8 additions & 12 deletions api/models/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ module.exports = bookshelf.Model.extend(merge({
requireFetch: false,
hasTimestamps: true,

format(attributes) {
const st = knexPostgis(bookshelf.knex)

// Make sure geometry column goes into the database correctly, converting from GeoJSON
const { geo_shape } = attributes
if (geo_shape) {
attributes.geo_shape = st.geomFromGeoJSON(geo_shape)
}

return attributes
},

parse(response) {
const st = knexPostgis(bookshelf.knex)

Expand Down Expand Up @@ -393,6 +381,14 @@ module.exports = bookshelf.Model.extend(merge({

saneAttrs.location_id = isEmpty(saneAttrs.location_id) ? null : saneAttrs.location_id

// Make sure geometry column goes into the database correctly, converting from GeoJSON
if (!isEmpty(attributes.geo_shape)) {
const st = knexPostgis(bookshelf.knex)
saneAttrs.geo_shape = st.geomFromGeoJSON(attributes.geo_shape)
} else {
saneAttrs.geo_shape = null
}

// If a new location is being passed in but not a new location_id then we geocode on the server
if (changes.location && changes.location !== this.get('location') && !changes.location_id) {
await Queue.classMethod('Group', 'geocodeLocation', { groupId: this.id })
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Tibet Sprague <tibet@hylo.com>",
"license": "GNU AFFERO GENERAL PUBLIC LICENSE v3",
"private": true,
"version": "4.1.4",
"version": "4.1.5",
"repository": {
"type": "git",
"url": "git://github.com/Hylozoic/hylo-node.git"
Expand Down

0 comments on commit e39e07b

Please sign in to comment.