Skip to content

Commit

Permalink
Merge branch 'master' into v2.1.4prod
Browse files Browse the repository at this point in the history
  • Loading branch information
RickWangPerth authored Dec 5, 2024
2 parents b243dc7 + 6f78909 commit 9ad7b49
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
2 changes: 2 additions & 0 deletions kustomize/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ secretGenerator:
type: Opaque
envs:
- .env
generatorOptions:
disableNameSuffixHash: true
resources:
- ../../base
- cronjobs/automated-qa
Expand Down
2 changes: 2 additions & 0 deletions kustomize/overlays/uat/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ secretGenerator:
type: Opaque
envs:
- .env
generatorOptions:
disableNameSuffixHash: true
resources:
- ../../base
- cronjobs/automated-qa
Expand Down
2 changes: 1 addition & 1 deletion observations/management/commands/automated_qa_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def handle(self, *args, **options):
enc.save()

# Check: Any turtle nest encounter with uncertain nest age.
nest_encounters = TurtleNestEncounter.objects.filter(nest_age=NEST_AGE_DEFAULT, status=Encounter.STATUS_IMPORTED)
nest_encounters = TurtleNestEncounter.objects.filter(nest_age="unknown", status=Encounter.STATUS_IMPORTED)
if nest_encounters:
logger.info(f'Flagging {nest_encounters.count()} turtle nest encounters for curation due to uncertain nest age')
for enc in nest_encounters:
Expand Down
38 changes: 19 additions & 19 deletions observations/tests/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_flag_nests_with_uncertain_nest_age(self, mock_get_logger):
TurtleNestEncounter.objects.create(
site=self.area,
status=Encounter.STATUS_IMPORTED,
nest_age=NEST_AGE_DEFAULT,
nest_age="unknown",
species=TURTLE_SPECIES,
when=datetime.now(pytz.utc),
where=Point(0.0, 0.0)
Expand Down Expand Up @@ -258,24 +258,24 @@ def test_flag_nests_with_specific_species_in_ningaloo(self, mock_get_logger):
call_command('automated_qa_checks')
mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation: Dermochelys coriacea (Leatherback turtle) at Ningaloo')

@patch('logging.getLogger')
def test_flag_imported_nests_with_unknown_reporter(self, mock_get_logger):
mock_logger = MagicMock()
mock_get_logger.return_value = mock_logger

TurtleNestEncounter.objects.create(
site=self.area,
status=Encounter.STATUS_IMPORTED,
species=TURTLE_SPECIES,
nest_age=NEST_AGE,
nest_type=NEST_TYPE,
reporter=self.unknown_user,
when=datetime.now(pytz.utc),
where=Point(0.0, 0.0)
)

call_command('automated_qa_checks')
mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation due to unknown reporter')
# @patch('logging.getLogger')
# def test_flag_imported_nests_with_unknown_reporter(self, mock_get_logger):
# mock_logger = MagicMock()
# mock_get_logger.return_value = mock_logger

# TurtleNestEncounter.objects.create(
# site=self.area,
# status=Encounter.STATUS_IMPORTED,
# species=TURTLE_SPECIES,
# nest_age=NEST_AGE,
# nest_type=NEST_TYPE,
# reporter=self.unknown_user,
# when=datetime.now(pytz.utc),
# where=Point(0.0, 0.0)
# )

# call_command('automated_qa_checks')
# mock_logger.info.assert_any_call('Flagging 1 turtle nest encounters for curation due to unknown reporter')

@patch('logging.getLogger')
def test_mark_imported_nests_as_curated(self, mock_get_logger):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_flag_nests_with_uncertain_nest_age(self, mock_get_logger):
TurtleNestEncounter.objects.create(
site=self.area,
status=Encounter.STATUS_IMPORTED,
nest_age=NEST_AGE_DEFAULT,
nest_age="unknown",
species=TURTLE_SPECIES,
when=datetime.now(pytz.utc),
where=Point(0.0, 0.0)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "wastd"
version = "2.1.4"


description = "Western Australian Sea Turtles Database"
authors = ["Florian Mayer <florian.mayer@dbca.wa.gov.au>", "Ashley Felton <ashley.felton@dbca.wa.gov.au>","Evan Hallein <evan.hallein@dbca.wa.gov.au>", "Rick Wang <rick.wang@dbca.wa.gov.au>"]
license = "MIT"
Expand Down

0 comments on commit 9ad7b49

Please sign in to comment.