details and monogram update

This commit is contained in:
2026-01-27 14:24:51 -05:00
parent 2bc01c90de
commit db35d8bd07
4 changed files with 21 additions and 3 deletions

View File

@@ -22,6 +22,24 @@ export class Analysis {
ORDER BY created_at DESC ORDER BY created_at DESC
LIMIT 1 LIMIT 1
`; `;
if (result && result.findings) {
// Ensure findings is parsed as an object
if (typeof result.findings === 'string') {
result.findings = JSON.parse(result.findings);
}
// Ensure nested arrays exist
if (!result.findings.positive) result.findings.positive = [];
if (!result.findings.negative) result.findings.negative = [];
if (!result.findings.neutral) result.findings.neutral = [];
}
// Ensure other array fields exist
if (result) {
if (!result.data_types_collected) result.data_types_collected = [];
if (!result.third_parties) result.third_parties = [];
}
return result || null; return result || null;
} }

View File

@@ -45,7 +45,7 @@
<p class="service-url"><%= service.url %></p> <p class="service-url"><%= service.url %></p>
<% if (service.grade) { %> <% if (service.grade) { %>
<span class="grade grade-<%= service.grade.toLowerCase() %>"> <span class="grade grade-<%= service.grade.toLowerCase() %>">
Grade <%= service.grade %> <%= service.grade %>
</span> </span>
<p class="last-analyzed"> <p class="last-analyzed">
Last analyzed: <%= new Date(service.last_analyzed).toLocaleDateString() %> Last analyzed: <%= new Date(service.last_analyzed).toLocaleDateString() %>

View File

@@ -41,7 +41,7 @@
<% if (service.grade) { %> <% if (service.grade) { %>
<div class="grade-display"> <div class="grade-display">
<span class="grade grade-<%= service.grade.toLowerCase() %>" id="service-<%= service.id %>-grade"> <span class="grade grade-<%= service.grade.toLowerCase() %>" id="service-<%= service.id %>-grade">
Grade <%= service.grade %> <%= service.grade %>
</span> </span>
<span class="visually-hidden">Privacy Grade <%= service.grade %></span> <span class="visually-hidden">Privacy Grade <%= service.grade %></span>
</div> </div>

View File

@@ -47,7 +47,7 @@
<% if (analysis) { %> <% if (analysis) { %>
<div class="grade-section"> <div class="grade-section">
<div class="grade-large grade-<%= analysis.overall_score.toLowerCase() %>"> <div class="grade-large grade-<%= analysis.overall_score.toLowerCase() %>">
Grade <%= analysis.overall_score %> <%= analysis.overall_score %>
</div> </div>
<p class="last-analyzed"> <p class="last-analyzed">