Harmonize review page properties between front and back ends

This commit is contained in:
Eli Ribble 2026-04-14 23:29:29 +00:00
parent b09725726c
commit 5451c297c2
No known key found for this signature in database
5 changed files with 19 additions and 13 deletions

View file

@ -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),

View file

@ -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"`
}

View file

@ -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<void> {

View file

@ -529,7 +529,6 @@ export interface Site {
creator_id: number;
file_id: number;
id: number;
location: Location;
notes: string;
organization_id: number;
owner?: Contact;

View file

@ -180,12 +180,18 @@ const changes = computed<Changes>(() => {
} 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 ?? "";