From c5d0d68f9595203429d8f047039a0558d21b5db7 Mon Sep 17 00:00:00 2001 From: Caden Newton Date: Thu, 7 Nov 2024 08:46:11 -0500 Subject: [PATCH] replace screen length well filter with unsat well filter --- npsat_manager/models.py | 10 +++++----- npsat_manager/serializers.py | 16 ++++++++-------- npsat_manager/tests/test_models.py | 4 ++-- npsat_manager/views.py | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/npsat_manager/models.py b/npsat_manager/models.py index 647d36c..4a07c55 100644 --- a/npsat_manager/models.py +++ b/npsat_manager/models.py @@ -297,8 +297,8 @@ class ModelRun(models.Model): # the range should be between 0 - 801; # 801 is reserved for the maximum value possible, when passing to message to mantis, set it to 10000 - screen_length_range_max = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5) - screen_length_range_min = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5) + unsat_range_max = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5) + unsat_range_min = models.DecimalField(null=True, blank=True, decimal_places=2, max_digits=5) # scenarios # here we use explicit fields and set a limit to each @@ -429,9 +429,9 @@ def input_message(self): range_max = str(self.depth_range_max) if self.depth_range_max != 801 else "10000" msg += f" DepthRange {str(self.depth_range_min)} {range_max}" - if self.screen_length_range_min is not None and self.screen_length_range_max is not None: - range_max = str(self.screen_length_range_max) if self.depth_range_max != 801 else "10000" - msg += f" ScreenLenRange {str(self.screen_length_range_min)} {range_max}" + if self.unsat_range_min is not None and self.unsat_range_max is not None: + range_max = str(self.unsat_range_max) if self.depth_range_max != 801 else "10000" + msg += f" UnsatRange {str(self.unsat_range_min)} {range_max}" msg += " ENDofMSG\n" return msg diff --git a/npsat_manager/serializers.py b/npsat_manager/serializers.py index c5bfdd3..49ddfa0 100644 --- a/npsat_manager/serializers.py +++ b/npsat_manager/serializers.py @@ -267,8 +267,8 @@ class Meta: "applied_simulation_filter", "depth_range_min", "depth_range_max", - "screen_length_range_min", - "screen_length_range_max" + "unsat_range_min", + "unsat_range_max" ) depth = 0 # should mean that modifications get included in the initial request extra_kwargs = {"user": {"required": False}} @@ -290,8 +290,8 @@ def create(self, validated_data): applied_simulation_filter = validated_data["applied_simulation_filter"] depth_range_min = validated_data.get("depth_range_min", None) depth_range_max = validated_data.get("depth_range_max", None) - screen_length_range_min = validated_data.get("screen_length_range_min", None) - screen_length_range_max = validated_data.get("screen_length_range_max", None) + unsat_range_min = validated_data.get("unsat_range_min", None) + unsat_range_max = validated_data.get("unsat_range_max", None) # check if there is a BAU created by CURRENT USER @@ -310,8 +310,8 @@ def create(self, validated_data): if (applied_simulation_filter): BAU_condition &= Q(depth_range_min=depth_range_min) BAU_condition &= Q(depth_range_max=depth_range_max) - BAU_condition &= Q(screen_length_range_min=screen_length_range_min) - BAU_condition &= Q(screen_length_range_max=screen_length_range_max) + BAU_condition &= Q(unsat_range_min=unsat_range_min) + BAU_condition &= Q(unsat_range_max=unsat_range_max) BAU_condition &= Q(sim_end_year=sim_end_year) BAU_instances = models.ModelRun.objects.filter(BAU_condition) for region in regions_data: @@ -340,8 +340,8 @@ def create(self, validated_data): applied_simulation_filter=applied_simulation_filter, depth_range_min=depth_range_min, depth_range_max=depth_range_max, - screen_length_range_min=screen_length_range_min, - screen_length_range_max=screen_length_range_max, + unsat_range_min=unsat_range_min, + unsat_range_max=unsat_range_max, ) else: BAU_model = models.ModelRun.objects.create( diff --git a/npsat_manager/tests/test_models.py b/npsat_manager/tests/test_models.py index 3a66bf1..379cda5 100644 --- a/npsat_manager/tests/test_models.py +++ b/npsat_manager/tests/test_models.py @@ -235,8 +235,8 @@ def test_ModelRun_create(self): # ), depth_range_max=350.22, depth_range_min=20.11, - screen_length_range_max=100.00, - screen_length_range_min=0.876, + unsat_range_max=100.00, + unsat_range_min=0.876, applied_simulation_filter=True ) model_run1.regions.add(models.Region.objects.get(name="Central Valley")) diff --git a/npsat_manager/views.py b/npsat_manager/views.py index a9b4b2a..95487fb 100644 --- a/npsat_manager/views.py +++ b/npsat_manager/views.py @@ -434,8 +434,8 @@ def retrieve(self, request, *args, **kwargs): porosity=instance.porosity, depth_range_min=instance.depth_range_min, depth_range_max=instance.depth_range_max, - screen_length_range_min=instance.screen_length_range_min, - screen_length_range_max=instance.screen_length_range_max, + unsat_range_min=instance.unsat_range_min, + unsat_range_max=instance.unsat_range_max, sim_end_year=instance.sim_end_year, )