From f6871e139dd0fddee790bc20fa54e8331f1c25ca Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 27 Feb 2025 17:51:57 -0700 Subject: [PATCH] fix linting --- src/views/ProjectViewView.vue | 172 ++++++++++++++++++++-------------- 1 file changed, 102 insertions(+), 70 deletions(-) diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 70be78d..885fcb2 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -341,23 +341,37 @@
Totals - + {{ givenTotalHours() }} {{ libsUtil.UNIT_SHORT["HUR"] }} - {{ givesTotalsByUnit[0].amount }} {{ libsUtil.UNIT_SHORT[givesTotalsByUnit[0].unit] }} + {{ givesTotalsByUnit[0].amount }} + {{ libsUtil.UNIT_SHORT[givesTotalsByUnit[0].unit] }} ... - +
-
- +
+ {{ total.amount }} {{ libsUtil.UNIT_LONG[total.unit] }}
@@ -365,7 +379,9 @@
- {{ givesToThis.length }}{{ givesHitLimit ? "+" : "" }} record{{ givesToThis.length === 1 ? "" : "s" }} + {{ givesToThis.length }}{{ givesHitLimit ? "+" : "" }} record{{ + givesToThis.length === 1 ? "" : "s" + }}
@@ -374,62 +390,71 @@ @@ -594,7 +619,7 @@ export default class ProjectViewView extends Vue { givesHitLimit = false; givesProvidedByThis: Array = []; givesProvidedByHitLimit = false; - givesTotalsByUnit: Array<{unit: string, amount: number}> = []; + givesTotalsByUnit: Array<{ unit: string; amount: number }> = []; imageUrl = ""; isRegistered = false; issuer = ""; @@ -1254,14 +1279,17 @@ export default class ProjectViewView extends Vue { async loadTotals() { this.loadingTotals = true; - const url = this.apiServer + "/api/v2/report/givesToPlans?planIds=" + encodeURIComponent(JSON.stringify([this.projectId])); + const url = + this.apiServer + + "/api/v2/report/givesToPlans?planIds=" + + encodeURIComponent(JSON.stringify([this.projectId])); const headers = await serverUtil.getHeaders(this.activeDid); try { const resp = await this.axios.get(url, { headers }); if (resp.status === 200 && resp.data.data) { // Calculate totals by unit - const totals: {[key: string]: number} = {}; + const totals: { [key: string]: number } = {}; resp.data.data.forEach((give: GiveSummaryRecord) => { const amount = give.fullClaim.object?.amountOfThisGood; const unit = give.fullClaim.object?.unitCode; @@ -1269,12 +1297,14 @@ export default class ProjectViewView extends Vue { totals[unit] = (totals[unit] || 0) + amount; } }); - + // Convert totals object to array format - this.givesTotalsByUnit = Object.entries(totals).map(([unit, amount]) => ({ - unit, - amount - })); + this.givesTotalsByUnit = Object.entries(totals).map( + ([unit, amount]) => ({ + unit, + amount, + }), + ); } } catch (error) { console.error("Error loading totals:", error); @@ -1293,7 +1323,9 @@ export default class ProjectViewView extends Vue { } givenTotalHours(): number { - return this.givesTotalsByUnit.find(total => total.unit === "HUR")?.amount || 0; + return ( + this.givesTotalsByUnit.find((total) => total.unit === "HUR")?.amount || 0 + ); } }