Files
Investidor-V2/outputs/investmoz-editorial-QA-20261018/refine.py
T
nala cf003c8623
tests / ci (push) Canceled after 0s
versao nrgocios 4
2026-10-18 15:57:06 +02:00

19 lines
2.0 KiB
Python

from pathlib import Path
q=Path('C:/Users/macbook/.config/investmoz/editorial-QA-20261018/source')
def edit(n,a,b):
p=q/n;s=p.read_text('utf8');assert a in s,n;p.write_text(s.replace(a,b,1),'utf8')
edit('app/Http/Controllers/EditorialArticleController.php',"'change_type'=>'editorial_updated'","'change_type'=>'metadata_updated'")
edit('app/Http/Controllers/PortalServicesController.php',"'downloadUrl' => route('services.download', ['id' => $id]),","'downloadUrl' => route('services.download', ['id' => $id]),\n 'articleUrl' => Schema::hasColumn('portal_resources','editorial_content') && DB::table('portal_resources')->where('id',$id)->whereNotNull('editorial_content')->exists() ? '/artigos/'.$id : null,")
edit('resources/js/pages/portal/document.tsx',' backUrl,',' backUrl,\n articleUrl,')
edit('resources/js/pages/portal/document.tsx',' downloadUrl: string;',' downloadUrl: string;\n articleUrl?: string | null;')
edit('resources/js/pages/portal/document.tsx','<Link className="underline" href={`/artigos/${resource.id}`}>Consultar adaptação editorial, quando disponível</Link>','{articleUrl && <Link className="underline" href={articleUrl}>Ler artigo</Link>}')
edit('app/Services/LegacyContent.php'," $localHtml = $this->localLinks($this->sanitize($source['content_html']));",''' $localHtml = $this->localLinks($this->sanitize($source['content_html']));
$editorial = \\Illuminate\\Support\\Facades\\Schema::hasColumn('portal_resources','editorial_content')
? DB::table('portal_resources')->where('id',$row->resource_id)->value('editorial_content') : null;
if ($editorial) {
$adaptation = json_decode($editorial,true,64,JSON_THROW_ON_ERROR);
$localHtml = implode('',array_map(fn($p) => '<p>'.nl2br(e($p)).'</p>',preg_split('/\\n\\s*\\n/',$adaptation['body'])));
$source['title'] = $row->title;
}''')
print('QA delta refined: revision enum reused, conditional article link, legacy body reader')