master #205
@ -372,7 +372,6 @@ class EditInterventionForm(NewInterventionForm):
 | 
			
		||||
 | 
			
		||||
            geometry = geom_form.save(user_action)
 | 
			
		||||
            self.instance.geometry = geometry
 | 
			
		||||
            self.instance.geometry.save()
 | 
			
		||||
 | 
			
		||||
            self.instance.log.add(user_action)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,7 @@ from django.utils import timezone
 | 
			
		||||
 | 
			
		||||
from konova.models import BaseResource, UuidModel
 | 
			
		||||
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
 | 
			
		||||
from konova.tasks import celery_check_for_geometry_conflicts
 | 
			
		||||
from konova.utils.wfs.spatial import ParcelWFSFetcher
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -28,7 +29,7 @@ class Geometry(BaseResource):
 | 
			
		||||
 | 
			
		||||
    def save(self, *args, **kwargs):
 | 
			
		||||
        super().save(*args, **kwargs)
 | 
			
		||||
        self.check_for_conflicts()
 | 
			
		||||
        celery_check_for_geometry_conflicts.delay(self.id)
 | 
			
		||||
 | 
			
		||||
    def check_for_conflicts(self):
 | 
			
		||||
        """ Checks for new geometry overlaps
 | 
			
		||||
 | 
			
		||||
@ -120,3 +120,10 @@ def celery_send_mail_deduction_changed(obj_identifier, obj_title=None, user_id=N
 | 
			
		||||
    from user.models import User
 | 
			
		||||
    user = User.objects.get(id=user_id)
 | 
			
		||||
    user.send_mail_deduction_changed(obj_identifier, obj_title, data_changes)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@shared_task
 | 
			
		||||
def celery_check_for_geometry_conflicts(geom_id):
 | 
			
		||||
    from konova.models import Geometry
 | 
			
		||||
    geometry = Geometry.objects.get(id=geom_id)
 | 
			
		||||
    geometry.check_for_conflicts()
 | 
			
		||||
 | 
			
		||||
@ -47,6 +47,7 @@ class GeometryTestCase(BaseTestCase):
 | 
			
		||||
        Returns:
 | 
			
		||||
 | 
			
		||||
        """
 | 
			
		||||
        self.geom_2.check_for_conflicts()
 | 
			
		||||
        conflict = GeometryConflict.objects.all()
 | 
			
		||||
        self.assertEqual(1, conflict.count())
 | 
			
		||||
        conflict = conflict.first()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user