{{ selectedObservation.notes }}
@@ -320,7 +322,8 @@
-
{{ selectedObservation.observer_phone_number }}
+
{{ selectedObservation.observer_phone_number }}
+
@@ -528,7 +531,7 @@ export default {
}
});
const canViewRestrictedFields = computed(() => {
- return vespaStore.isAdmin ||
+ return vespaStore.isAdmin ||
(isLoggedIn.value && vespaStore.userMunicipalities.includes(selectedObservation.value?.municipality_name));
});
@@ -650,7 +653,7 @@ export default {
const today = new Date();
editableObservation.value.eradication_date = today.toISOString().split('T')[0];
}
-
+
// Format eradication_date if provided, and check for valid eradication result
if (editableObservation.value.eradication_date) {
const date = new Date(editableObservation.value.eradication_date);
@@ -679,7 +682,7 @@ export default {
errorMessage.value = 'Er is een fout opgetreden bij het opslaan van de wijzigingen.';
}
console.error('Error updating observation:', error);
- }finally {
+ } finally {
isUpdating.value = false;
}
};
@@ -769,7 +772,8 @@ export default {
editableObservation,
errorMessage,
eradicationResultError,
- canViewRestrictedFields
+ canViewRestrictedFields,
+ validationStatusEnum
};
}
};
diff --git a/src/stores/vespaStore.js b/src/stores/vespaStore.js
index 644c020..e59b0b8 100644
--- a/src/stores/vespaStore.js
+++ b/src/stores/vespaStore.js
@@ -54,8 +54,7 @@ export const useVespaStore = defineStore('vespaStore', {
)?.name;
return (
state.isLoggedIn &&
- state.userMunicipalities.includes(municipalityName) &&
- !observation.reserved_by
+ state.userMunicipalities.includes(municipalityName)
);
},
canEditAdminFields: (state) => state.isAdmin,
@@ -457,6 +456,8 @@ export const useVespaStore = defineStore('vespaStore', {
return '#198754';
} else if (status === 'eradicated') {
return '#198754';
+ } else if (status === 'unsuccessful') {
+ return '#198754';
} else if (status === 'reserved') {
return '#ea792a';
}
diff --git a/vespadb/observations/admin.py b/vespadb/observations/admin.py
index 59f578d..02e75b0 100644
--- a/vespadb/observations/admin.py
+++ b/vespadb/observations/admin.py
@@ -151,7 +151,6 @@ class ObservationAdmin(gis_admin.GISModelAdmin):
"source",
"wn_id",
"wn_validation_status",
- "wn_admin_notes",
"observer_name",
"observer_phone_number",
"created_datetime",
diff --git a/vespadb/observations/views.py b/vespadb/observations/views.py
index 38430cb..7577e03 100644
--- a/vespadb/observations/views.py
+++ b/vespadb/observations/views.py
@@ -46,7 +46,7 @@
from vespadb.observations.cache import invalidate_geojson_cache, invalidate_observation_cache
from vespadb.observations.filters import ObservationFilter
from vespadb.observations.helpers import parse_and_convert_to_utc
-from vespadb.observations.models import Municipality, Observation, Province
+from vespadb.observations.models import Municipality, Observation, Province, EradicationResultEnum
from vespadb.observations.serializers import (
MunicipalitySerializer,
ObservationSerializer,
@@ -393,7 +393,7 @@ def geojson(self, request: Request) -> HttpResponse:
"properties": {
"id": obs.id,
"status": "eradicated"
- if obs.eradication_result == "successful"
+ if obs.eradication_result is not None
else "reserved"
if obs.reserved_by
else "default",
@@ -744,7 +744,7 @@ def serialize_observation(self, obj: Observation, headers: list[str], allowed_fi
elif field == "anb_domain":
data.append(str(obj.anb))
elif field == "eradication_result":
- data.append(obj.eradication_result.value if obj.eradication_result else "")
+ data.append(obj.eradication_result if obj.eradication_result else "")
elif field == "nest_status":
logger.info("Getting status for observation %s", obj.eradication_result)
# This is handled as requested with eradication result
diff --git a/vespadb/users/utils.py b/vespadb/users/utils.py
index 0038395..4214259 100644
--- a/vespadb/users/utils.py
+++ b/vespadb/users/utils.py
@@ -5,9 +5,12 @@
from vespadb.users.models import UserType, VespaUser
-def get_system_user(user_type: Literal[UserType.SYNC, UserType.IMPORT]) -> VespaUser:
- """Get System Users based on usertype."""
+def get_system_user(user_type: Literal[UserType.SYNC]) -> VespaUser:
+ """Get the system user specifically for SYNC."""
+ if user_type != UserType.SYNC:
+ raise ValueError("This function only supports UserType.SYNC.")
+
system_user, _ = VespaUser.objects.get_or_create(
- username=user_type.value, first_name="vespadb", defaults={"user_type": user_type.value}
+ username="sync", defaults={"user_type": UserType.SYNC.value}
)
return cast(VespaUser, system_user) # make mypy happy