fix: Generate Google Maps URL from place_id when google_maps_url is missing

- Template now uses google_place_id to generate Maps URL if google_maps_url is empty
- gbp_audit_service.py now copies google_maps_url from website_analysis

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-01-11 23:41:44 +01:00
parent 772d4e7453
commit 6f17ef5dfd
2 changed files with 4 additions and 2 deletions

View File

@ -187,6 +187,7 @@ class GBPAuditService:
if website_analysis:
google_place_id = website_analysis.google_place_id
google_maps_url = website_analysis.google_maps_url
review_count = website_analysis.google_reviews_count or 0
average_rating = website_analysis.google_rating

View File

@ -792,8 +792,9 @@
</svg>
Profil firmy
</a>
{% if audit and audit.google_maps_url %}
<a href="{{ audit.google_maps_url }}" target="_blank" rel="noopener" class="btn btn-outline btn-sm" style="color: #4285f4; border-color: #4285f4;">
{% if audit and (audit.google_maps_url or audit.google_place_id) %}
{% set gbp_url = audit.google_maps_url if audit.google_maps_url else 'https://www.google.com/maps/search/?api=1&query=Google&query_place_id=' ~ audit.google_place_id %}
<a href="{{ gbp_url }}" target="_blank" rel="noopener" class="btn btn-outline btn-sm" style="color: #4285f4; border-color: #4285f4;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
</svg>