Skip to content

Commit

Permalink
take in account reports with older formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
stitch committed Sep 19, 2023
1 parent 6f5a9d0 commit 90cabae
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NODE_ENV=development
VUE_APP_DJANGO_PATH=http://localhost:8000
# VUE_APP_DJANGO_PATH=https://acc.dashboard.internet.nl
# VUE_APP_DJANGO_PATH=https://dashboard.internet.nl
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ pnpm-debug.log*
*.njsproj
*.sln
*.sw?

# development
.env.development
7 changes: 6 additions & 1 deletion src/components/reports/ReportTableVirtualListRecord.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,12 @@ export default {
if (!url.endpoints[0].ratings_by_type[category_name]['since'])
return ''
let evidence = url.endpoints[0].ratings_by_type[category_name]['evidence']
// evidence is in new reports since sept 2023.
let evidence = ''
if ('key' in url.endpoints[0].ratings_by_type[category_name]) {
evidence = url.endpoints[0].ratings_by_type[category_name]['evidence']
}
let displayed_evidence = ''
if (evidence.charAt(0) === '{' && evidence !== '{}') {
displayed_evidence = JSON.stringify(JSON.parse(evidence), null, 2);
Expand Down
7 changes: 6 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ Vue.mixin(
humanize_date_unix_timestamp: function (date) {
if ([undefined, null, "", 0].includes(date))
return ""
return format(new Date(date * 1000), 'PPPP', {locale: this.dateLocales[this.locale]});
try {
return format(new Date(date * 1000), 'PPPP', {locale: this.dateLocales[this.locale]});
} catch (e) {
// old reports have datetime strings, sep 2023
return this.humanize_date(date);
}
},
humanize_date_date_only: function (date) {
if ([undefined, null, "", 0].includes(date))
Expand Down

0 comments on commit 90cabae

Please sign in to comment.