From 81d56f3bc9b0a74d3c1091e5e30cace4d27e93a4 Mon Sep 17 00:00:00 2001 From: Finn Date: Tue, 20 Aug 2019 14:33:44 +0100 Subject: [PATCH 1/2] removed console logs that show password --- src/app/auth/login.component.ts | 4 ---- src/app/auth/register.component.ts | 1 - 2 files changed, 5 deletions(-) diff --git a/src/app/auth/login.component.ts b/src/app/auth/login.component.ts index a381db5..07a0766 100644 --- a/src/app/auth/login.component.ts +++ b/src/app/auth/login.component.ts @@ -40,15 +40,11 @@ export class LoginComponent implements OnInit { } onSubmit() { - console.log(this.signin.value); - this.api .login(this.signin.value) .subscribe( result => { - console.log('logged in!'); this.loginStatus = 'success'; - console.log(this.loginStatus); this.router.navigate([this.returnUrl]); }, error => { diff --git a/src/app/auth/register.component.ts b/src/app/auth/register.component.ts index deab4d0..7a44f08 100644 --- a/src/app/auth/register.component.ts +++ b/src/app/auth/register.component.ts @@ -116,7 +116,6 @@ export class RegisterComponent { town: organisationForm.town, postcode: organisationForm.postcode, }; - console.log(data); this.api .register(data) .subscribe( From ed2025b67da6bd8ee06640a7cfcfab1f24723f34 Mon Sep 17 00:00:00 2001 From: Finn Date: Tue, 20 Aug 2019 16:43:53 +0100 Subject: [PATCH 2/2] properly displaying essential purchases dataset --- src/app/dashboard/dashboard.component.html | 166 ++++++++++----------- src/app/dashboard/dashboard.component.ts | 27 ++-- src/environments/environment.ts | 2 +- 3 files changed, 100 insertions(+), 95 deletions(-) diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 8520235..7c5dafd 100644 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -12,101 +12,101 @@ -
-
-
-
-
-
-

Number of Essential Purchases

-
-
-
- -
-
-
-
-
-
-
-
-
-

All Organisation Purchases by Category

-
-
-
- -
-
-
-
-
-
+
+
+
-

Spending by Category

+

Number of Essential Purchases

-
+
+ [datasets]="barChartDataEssential" + [labels]="barChartLabelsEssential" + [options]="barChartOptionsEssential" + [chartType]="barChartTypeEssential" + (chartHover)="chartHovered($event)" + (chartClick)="chartClicked($event)">
-
+
+
+
+
+
+
+

All Organisation Purchases by Category

+
+
+
+ +
+
+
+
+
+
+
+
+
+

Spending by Category

+
+
+
+ +
+
+
+
-
-
-
-
-
-

Global Puchases by Category

-
-
-
-
    - -
  • - -
    -
    {{ category.category || 'N/A' }}
    -
    -
    -
    Bought
    - {{ category.value || 'N/A' }} +
    +
    +
    +
    +
    +

    Global Puchases by Category

    +
    +
    +
    +
      + +
    • + +
      +
      {{ category.category || 'N/A' }}
      +
      +
      +
      Bought
      + {{ category.value || 'N/A' }} +
      +
    • +
    • + +
    • +
    -
  • -
  • - -
  • -
+
+
-
-
-
-
+
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index ddd479b..9a0367d 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -97,13 +97,13 @@ export class DashboardComponent { public purchaseNotEssential: number; public purchaseEssential: number; - public showEssentialBarChart = false; + public showEssentialBarChart:boolean = false; public showCategoryBarChart = false; public showCategoryDoughnutChart = false; - public barChartDataEssential:any[]=[ - {data: 0, label: 'Essential', stack: '1'}, - {data: 0, label: 'Non-Essential', stack: '1'}, + public barChartDataEssential: ChartDataSets[] = [ + {data: [0], label: 'Essential', stack: '1'}, + {data: [0], label: 'Non-Essential', stack: '1'}, ]; public barChartLabelsEssential:string[] = ['All Purchases']; public barChartOptionsEssential:any = { @@ -247,17 +247,11 @@ export class DashboardComponent { this.setWeekPurchaseList(result.weeks); this.setWeekData(result); this.setChartDataCat(result.data.cat_total); + this.setChartDataEssential(result.data.essentials); this.totalCategoryList = result.data.cat_list; if (this.totalCategoryList) { this.showTotalCategoryList = true; } - this.purchaseEssential = result.data.essentials.purchase_no_essential_total; - this.purchaseNotEssential = result.data.essentials.purchase_no_total - this.purchaseEssential; - this.barChartDataEssential = [ - {data: this.purchaseEssential, label: 'Essential', stack: '1'}, - {data: this.purchaseNotEssential, label: 'Non-Essential', stack: '1'}, - ]; - this.showEssentialBarChart = true; }, error => { console.log('Retrieval Error'); @@ -266,6 +260,17 @@ export class DashboardComponent { ); } + private setChartDataEssential (dataEs: any) { + this.purchaseEssential = dataEs.purchase_no_essential_total; + this.purchaseNotEssential = dataEs.purchase_no_total - this.purchaseEssential; + this.barChartDataEssential = [ + {data: [this.purchaseEssential], label: 'Essential', stack: '1'}, + {data: [this.purchaseNotEssential], label: 'Non-Essential', stack: '1'}, + ]; + this.showEssentialBarChart = true; + console.log(this.barChartDataEssential); + } + private setChartDataCat(dataCat: any) { this.barChartLabelsCategory = Object.keys(dataCat); let barChartDataCategoryInitial = Object.keys(dataCat).map(key => dataCat[key]); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4dd4515..bd440f0 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,7 +5,7 @@ export const environment = { production: false, - apiUrl: 'https://dev.peartrade.org/api', + apiUrl: 'https://dev.localspend.co.uk/api', mapApiKey: 'CHANGEME', enableAnalytics: false, analyticsKey: 'CHANGEME',