diff --git a/resource/review_task.go b/resource/review_task.go index 2115f92c..5733c57e 100644 --- a/resource/review_task.go +++ b/resource/review_task.go @@ -32,14 +32,15 @@ type reviewTask struct { Created time.Time `json:"created"` Creator platform.User `json:"creator"` ID int32 `json:"id"` - Location types.Location `json:"location"` Pool reviewTaskPool `json:"pool"` Reviewed *time.Time `json:"addressed"` Reviewer *platform.User `json:"addressor"` } type reviewTaskPool struct { - Condition string `json:"condition"` - Site types.Site `json:"site"` + Condition string `json:"condition"` + Location types.Location `json:"location"` + Owner types.Contact `json:"owner"` + Site types.Site `json:"site"` } type contentListReviewTask struct { Tasks []reviewTask `json:"tasks"` @@ -136,12 +137,12 @@ func (res *reviewTaskR) List(ctx context.Context, r *http.Request, user platform Created: row.Created, Creator: *users_by_id[row.CreatorID], ID: row.ID, - Location: types.Location{ - Latitude: row.Latitude, - Longitude: row.Longitude, - }, Pool: reviewTaskPool{ Condition: row.Condition, + Location: types.Location{ + Latitude: row.Latitude, + Longitude: row.Longitude, + }, }, Reviewed: row.Reviewed, Reviewer: userOrNil(users_by_id, row.ReviewerID), diff --git a/resource/session.go b/resource/session.go index 894678e0..cb032419 100644 --- a/resource/session.go +++ b/resource/session.go @@ -23,7 +23,7 @@ func Session(r *router) *sessionR { } type organization struct { - ID int32 `json:"organization_id"` + ID int32 `json:"id"` ServiceArea *types.ServiceArea `json:"service_area"` } diff --git a/ts/store/review-task.ts b/ts/store/review-task.ts index ca40af67..8c217b6d 100644 --- a/ts/store/review-task.ts +++ b/ts/store/review-task.ts @@ -20,7 +20,7 @@ export const useReviewTaskStore = defineStore("review-task", () => { function all(): ReviewTask[] { return Array.from(_byID.value.values()); } - function byID(id: number) { + function byID(id: number): ReviewTask | undefined { return _byID.value.get(id); } async function fetchAll(): Promise { diff --git a/ts/type/api.ts b/ts/type/api.ts index 7e76f704..b0f324cc 100644 --- a/ts/type/api.ts +++ b/ts/type/api.ts @@ -529,7 +529,6 @@ export interface Site { creator_id: number; file_id: number; id: number; - location: Location; notes: string; organization_id: number; owner?: Contact; diff --git a/ts/view/review/Pool.vue b/ts/view/review/Pool.vue index 107bfa00..6f6de288 100644 --- a/ts/view/review/Pool.vue +++ b/ts/view/review/Pool.vue @@ -180,12 +180,18 @@ const changes = computed(() => { } else { unchanged.push("condition"); } - if (newPoolLocation.value.latitude != pool.site.location.latitude) { + if ( + newPoolLocation.value && + newPoolLocation.value.latitude != pool.site.address.location?.latitude + ) { updated.push("latitude"); } else { unchanged.push("latitude"); } - if (newPoolLocation.value.longitude != pool.site.location.longitude) { + if ( + newPoolLocation.value && + newPoolLocation.value.longitude != pool.site.address.location?.longitude + ) { updated.push("longitude"); } else { unchanged.push("longitude"); @@ -216,7 +222,6 @@ async function fetchTasks() { // Helper Functions // Task Selection function selectTask(id: number): void { - console.log("Selected task", id); selectedTaskID.value = id; const task = reviewTask.byID(id); @@ -229,6 +234,7 @@ function selectTask(id: number): void { console.log("no pool for selected task"); return; } + console.log("selecting task", id, task); newPoolCondition.value = pool.condition; newPoolLocation.value = pool.location; newOwnerName.value = pool.site.owner?.name ?? "";