Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boranga UAT Tasks #549

Merged
merged 22 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6e53ebc
Remove unused preview script.
oakdbca Jan 3, 2025
bfcda9a
Fix curation typo (incorrectly spelt curration).
oakdbca Jan 3, 2025
f4b4c7e
Make last data curation date fields only accept current and past dates.
oakdbca Jan 3, 2025
9b221d9
Don't exit to the dashboard when activating a record.
oakdbca Jan 3, 2025
0746071
Change comment field on CS model to text field to store more characters.
oakdbca Jan 3, 2025
d2ec195
Move Conservation Criteria above WA Priority List.
oakdbca Jan 3, 2025
78d9b7f
Main profile is now not editable when in 'view' mode.
oakdbca Jan 3, 2025
6cbdc2a
Add edit action when in view mode. Clicking the edit button allows th…
oakdbca Jan 6, 2025
6f2ab08
Reload the species communities form when activating edit mode so that…
oakdbca Jan 6, 2025
aada25e
Scientific name is now locked once a record is 'Active' (except when …
oakdbca Jan 6, 2025
95d0911
Make active records require the same validation when saving as they h…
oakdbca Jan 6, 2025
f07d757
Fix saveOccurrenceReport to not emit when a select2 fired the event (…
oakdbca Jan 6, 2025
3ba51b5
Add auto save to SC form (saves without confirmation on the change ev…
oakdbca Jan 6, 2025
743c410
When removing a region, only remove the districts of that region (lea…
oakdbca Jan 6, 2025
0109dc1
Changes to add auto save to form and fix issue that was removing all …
oakdbca Jan 6, 2025
20c3600
Add OtherConservationAssessmentList model.
oakdbca Jan 6, 2025
af62f2f
Convert other_conservation_assessment field into list (foreign key).
oakdbca Jan 6, 2025
bb163b3
Create basic admin for other conservation assessment list.
oakdbca Jan 6, 2025
0c7e9d3
Add other_conservation_assessments to appropriate dictionary end poin…
oakdbca Jan 6, 2025
edff3f3
Modify serializers to support new other conservation assessment list.
oakdbca Jan 6, 2025
8cdde79
Incorporate new other conservation assessment list into front end.
oakdbca Jan 6, 2025
87a4216
Fix bug that was hiding layer tool.
oakdbca Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading