Complete map refresh guards and fix the dashboard job embed

This commit is contained in:
2026-10-06 12:18:22 +05:00
parent 923abdc472
commit 5f43e97d32
11 changed files with 127 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
-- Run against the configured project; all fixture changes roll back.
begin;
do $$
declare original public.datasets; fixture uuid; job uuid; owner uuid; moderator uuid; before_path text; before_revision uuid;
declare original public.datasets; fixture uuid; fixture_child uuid; job uuid; child_job uuid; owner uuid; moderator uuid; before_path text; before_revision uuid;
begin
select * into original from public.datasets where state='published' and parent_dataset_id is null limit 1;
if not found then raise exception 'A published fixture source is required'; end if;
@@ -53,5 +53,21 @@ begin
exception when others then
if sqlerrm<>'Capture boundaries must match the map exactly' then raise; end if;
end;
insert into public.datasets(owner_id,server_id,name,source,bounds,state,parent_dataset_id,contribution_status,contribution_count)
values(owner,original.server_id,'Refresh guard contribution',original.source,original.bounds,'draft',fixture,'pending',1) returning id into fixture_child;
begin
perform public.refresh_map(fixture_child,owner,original.id);
raise exception 'Contribution refresh succeeded';
exception when others then
if sqlerrm<>'Only a map can refresh its guessing map' then raise; end if;
end;
insert into public.upload_jobs(dataset_id,kind,source_dataset_id,state,lease_owner,lease_until)
values(fixture_child,'map',original.id,'running','regression',now()+interval '2 minutes') returning id into child_job;
begin
perform public.complete_job(child_job,'regression',0,'');
raise exception 'Contribution map render completed';
exception when others then
if sqlerrm<>'Contributions cannot refresh a guessing map' then raise; end if;
end;
end; $$;
rollback;