#138 WIP Improvements

* adds geom back writing to form field in case of invalid geometry, so the invalid geometry will be shown again
* updates tests
* fixes bug where race condition of celery workers could lead to duplicates in parcels (needs migration)
This commit is contained in:
2022-04-20 11:55:03 +02:00
parent 49c14a67b6
commit c60afb0391
12 changed files with 179 additions and 46 deletions

View File

@@ -6,9 +6,11 @@ Created on: 26.10.21
"""
import datetime
import json
from codelist.settings import CODELIST_CONSERVATION_OFFICE_ID
from ema.models import Ema
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
from user.models import User, Team
from django.contrib.auth.models import Group
from django.contrib.gis.geos import MultiPolygon, Polygon
@@ -287,8 +289,28 @@ class BaseTestCase(TestCase):
"""
polygon = Polygon.from_bbox((7.592449, 50.359385, 7.593382, 50.359874))
polygon.srid = 4326
polygon = polygon.transform(3857, clone=True)
return MultiPolygon(polygon, srid=3857) # 3857 is the default srid used for MultiPolygonField in the form
polygon = polygon.transform(DEFAULT_SRID_RLP, clone=True)
return MultiPolygon(polygon, srid=DEFAULT_SRID_RLP)
def create_geojson(self, geometry):
""" Creates a default structure including geojson from a geometry
Args:
geometry ():
Returns:
"""
geom_json = {
"features": [
{
"type": "Feature",
"geometry": json.loads(geometry.geojson),
}
]
}
geom_json = json.dumps(geom_json)
return geom_json
def create_dummy_handler(self) -> Handler:
""" Creates a Handler