Skip to content

Commit

Permalink
Merge pull request #549 from oakdbca/main
Browse files Browse the repository at this point in the history
Boranga UAT Tasks
  • Loading branch information
xzzy authored Jan 6, 2025
2 parents f1fe199 + 87a4216 commit 30e7e02
Show file tree
Hide file tree
Showing 22 changed files with 2,175 additions and 1,708 deletions.
9 changes: 9 additions & 0 deletions boranga/components/conservation_status/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class CommonwealthConservationListAdmin(ArchivableModelAdminMixin, AbstractListA
pass


class OtherConservationAssessmentListAdmin(
ArchivableModelAdminMixin, AbstractListAdmin
):
pass


class ConservationChangeCodeAdmin(ArchivableModelAdminMixin, DeleteProtectedModelAdmin):
list_display = ["code", "label"]

Expand All @@ -61,4 +67,7 @@ class ConservationChangeCodeAdmin(ArchivableModelAdminMixin, DeleteProtectedMode
admin.site.register(
models.CommonwealthConservationList, CommonwealthConservationListAdmin
)
admin.site.register(
models.OtherConservationAssessmentList, OtherConservationAssessmentListAdmin
)
admin.site.register(models.ConservationChangeCode, ConservationChangeCodeAdmin)
7 changes: 7 additions & 0 deletions boranga/components/conservation_status/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
ConservationStatusUserAction,
CSExternalRefereeInvite,
IUCNVersion,
OtherConservationAssessmentList,
ProposalAmendmentReason,
WALegislativeCategory,
WALegislativeList,
Expand Down Expand Up @@ -176,6 +177,9 @@ def get(self, request, format=None):
"commonwealth_conservation_categories": CommonwealthConservationList.get_lists_dict(
group_type, active_only=True
),
"other_conservation_assessments": OtherConservationAssessmentList.get_lists_dict(
group_type, active_only=True
),
"change_codes": ConservationChangeCode.get_filter_list(),
"active_change_codes": ConservationChangeCode.get_active_filter_list(),
"submitter_categories": SubmitterCategory.get_filter_list(),
Expand Down Expand Up @@ -2012,6 +2016,9 @@ def filter_list(self, request, *args, **kwargs):
"commonwealth_conservation_categories": CommonwealthConservationList.get_lists_dict(
group_type
),
"other_conservation_assessments": OtherConservationAssessmentList.get_lists_dict(
group_type
),
"processing_status_list": processing_status_list,
}
res_json = json.dumps(res_json)
Expand Down
17 changes: 14 additions & 3 deletions boranga/components/conservation_status/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ class Meta:
verbose_name = "Commonwealth Conservation Category"


class OtherConservationAssessmentList(AbstractConservationList):

class Meta:
ordering = ["code"]
app_label = "boranga"
verbose_name = "Other Conservation Assessment"


class ConservationChangeCode(ArchivableModel):
"""
When the conservation status of a species/community is changed, it can be for a number of reasons.
Expand Down Expand Up @@ -577,8 +585,11 @@ class ConservationStatus(SubmitterInformationModelMixin, RevisionedMixin):
# Leave the following as _list otherwise django has remove the field and create a new one
related_name="curr_commonwealth_conservation_list",
)
other_conservation_assessment = models.CharField(
max_length=100, blank=True, null=True
other_conservation_assessment = models.ForeignKey(
OtherConservationAssessmentList,
on_delete=models.PROTECT,
blank=True,
null=True,
)
conservation_criteria = models.CharField(max_length=100, blank=True, null=True)
cam_mou = models.BooleanField(null=True, blank=True)
Expand All @@ -600,7 +611,7 @@ class ConservationStatus(SubmitterInformationModelMixin, RevisionedMixin):
null=True,
)

comment = models.CharField(max_length=512, blank=True, null=True)
comment = models.TextField(blank=True, null=True)
review_due_date = models.DateField(null=True, blank=True)
effective_from = models.DateField(null=True, blank=True)
effective_to = models.DateField(null=True, blank=True)
Expand Down
26 changes: 24 additions & 2 deletions boranga/components/conservation_status/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ class BaseConservationStatusSerializer(serializers.ModelSerializer):
commonwealth_conservation_category = serializers.SerializerMethodField(
read_only=True
)
other_conservation_assessment = serializers.SerializerMethodField(read_only=True)

class Meta:
model = ConservationStatus
Expand All @@ -562,6 +563,7 @@ class Meta:
"wa_priority_category",
"commonwealth_conservation_category_id",
"commonwealth_conservation_category",
"other_conservation_assessment_id",
"other_conservation_assessment",
"conservation_criteria",
"comment",
Expand Down Expand Up @@ -643,6 +645,18 @@ def get_commonwealth_conservation_category(self, obj):

return obj.commonwealth_conservation_category.code

def get_other_conservation_assessment(self, obj):
if not obj.other_conservation_assessment:
return None

if (
obj.other_conservation_assessment.code
and obj.other_conservation_assessment.label
):
return f"{obj.other_conservation_assessment.code} - {obj.other_conservation_assessment.label}"

return obj.other_conservation_assessment.code

def get_readonly(self, obj):
return False

Expand Down Expand Up @@ -788,6 +802,7 @@ class Meta:
"wa_priority_category_id",
"commonwealth_conservation_category_id",
"other_conservation_assessment",
"other_conservation_assessment_id",
"conservation_criteria",
]

Expand Down Expand Up @@ -853,6 +868,7 @@ class Meta:
"wa_priority_category",
"commonwealth_conservation_category_id",
"commonwealth_conservation_category",
"other_conservation_assessment_id",
"other_conservation_assessment",
"conservation_criteria",
"comment",
Expand Down Expand Up @@ -1092,6 +1108,9 @@ class SaveSpeciesConservationStatusSerializer(BaseConservationStatusSerializer):
commonwealth_conservation_category_id = serializers.IntegerField(
required=False, allow_null=True, write_only=True
)
other_conservation_assessment_id = serializers.IntegerField(
required=False, allow_null=True, write_only=True
)
change_code_id = serializers.IntegerField(
required=False, allow_null=True, write_only=True
)
Expand All @@ -1113,7 +1132,7 @@ class Meta:
"wa_priority_list_id",
"wa_priority_category_id",
"commonwealth_conservation_category_id",
"other_conservation_assessment",
"other_conservation_assessment_id",
"conservation_criteria",
"comment",
"lodgement_date",
Expand Down Expand Up @@ -1251,6 +1270,9 @@ class SaveCommunityConservationStatusSerializer(BaseConservationStatusSerializer
commonwealth_conservation_category_id = serializers.IntegerField(
required=False, allow_null=True, write_only=True
)
other_conservation_assessment_id = serializers.IntegerField(
required=False, allow_null=True, write_only=True
)
change_code_id = serializers.IntegerField(
required=False, allow_null=True, write_only=True
)
Expand All @@ -1267,7 +1289,7 @@ class Meta:
"wa_priority_list_id",
"wa_priority_category_id",
"commonwealth_conservation_category_id",
"other_conservation_assessment",
"other_conservation_assessment_id",
"conservation_criteria",
"comment",
"lodgement_date",
Expand Down
4 changes: 2 additions & 2 deletions boranga/components/species_and_communities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class Species(RevisionedMixin):
districts = models.ManyToManyField(
District, blank=True, related_name="species_districts"
)
last_data_curration_date = models.DateField(blank=True, null=True)
last_data_curation_date = models.DateField(blank=True, null=True)
conservation_plan_exists = models.BooleanField(default=False)
conservation_plan_reference = models.CharField(
max_length=500, null=True, blank=True
Expand Down Expand Up @@ -1230,7 +1230,7 @@ class Community(RevisionedMixin):
districts = models.ManyToManyField(
District, blank=True, related_name="community_districts"
)
last_data_curration_date = models.DateField(blank=True, null=True)
last_data_curation_date = models.DateField(blank=True, null=True)
conservation_plan_exists = models.BooleanField(default=False)
conservation_plan_reference = models.CharField(
max_length=500, null=True, blank=True
Expand Down
12 changes: 6 additions & 6 deletions boranga/components/species_and_communities/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ class Meta:
"distribution",
"regions",
"districts",
"last_data_curration_date",
"last_data_curation_date",
"image_doc",
"processing_status",
"applicant",
Expand Down Expand Up @@ -838,7 +838,7 @@ class Meta:
"publishing_status",
"regions",
"districts",
"last_data_curration_date",
"last_data_curation_date",
"image_doc",
"processing_status",
"readonly",
Expand Down Expand Up @@ -1114,7 +1114,7 @@ class Meta:
"distribution",
"publishing_status",
"conservation_attributes",
"last_data_curration_date",
"last_data_curation_date",
"image_doc",
"processing_status",
"lodgement_date",
Expand Down Expand Up @@ -1294,7 +1294,7 @@ class Meta:
"distribution",
"publishing_status",
"conservation_attributes",
"last_data_curration_date",
"last_data_curation_date",
"image_doc",
"processing_status",
"lodgement_date",
Expand Down Expand Up @@ -1377,7 +1377,7 @@ class Meta:
"id",
"group_type",
"taxonomy_id",
"last_data_curration_date",
"last_data_curation_date",
"submitter",
"readonly",
"can_user_edit",
Expand Down Expand Up @@ -1424,7 +1424,7 @@ class Meta:
fields = (
"id",
"group_type",
"last_data_curration_date",
"last_data_curation_date",
"submitter",
"readonly",
"can_user_edit",
Expand Down
3 changes: 1 addition & 2 deletions boranga/frontend/boranga/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"scripts": {
"lint": "eslint -c eslint.config.mjs .",
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
"build": "vite build"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.0",
Expand Down
27 changes: 12 additions & 15 deletions boranga/frontend/boranga/src/components/common/component_map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,21 @@
</div>
<div v-show="map" class="optional-layers-wrapper">
<div style="position: relative">
<transition>
<div
v-show="hover"
class="optional-layers-button-wrapper"
:title="`There are ${optionalLayers.length} optional layers available}`"
>
<!-- :class="
<div
class="optional-layers-button-wrapper"
:title="`There are ${optionalLayers.length} optional layers available}`"
>
<!-- :class="
optionalLayers.length ? '' : 'disabled'
" -->
<div
class="optional-layers-button btn"
:class="isEditingALayer ? 'btn-danger' : ''"
@mouseover="hover = true"
>
<img src="../../assets/layers.svg" />
</div>
<div
class="optional-layers-button btn"
:class="isEditingALayer ? 'btn-danger' : ''"
@mouseover="hover = true"
>
<img src="../../assets/layers.svg" />
</div>
</transition>
</div>
<transition>
<div
v-show="hover"
Expand Down
Loading

0 comments on commit 30e7e02

Please sign in to comment.