-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from skounis/feat/issue-42-analytics
Feat/issue 42 analytics
- Loading branch information
Showing
9 changed files
with
143 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<div style="margin-bottom: 5px;"> | ||
<mat-progress-bar class="example-margin" color="primary" mode="determinate" [value]="progress" [bufferValue]=" value"> | ||
</mat-progress-bar> | ||
</div> | ||
<mat-chip-list aria-label="Fish selection"> | ||
<mat-chip> | ||
<mat-icon aria-hidden="false" aria-label="Example home icon">qr_code</mat-icon> | ||
{{analytics?.progress(null)}} / {{analytics?.codes()}} | ||
</mat-chip> | ||
<mat-chip color="primary" selected> | ||
<!-- <mat-icon aria-hidden="false" aria-label="Example home icon">check_circle</mat-icon> --> | ||
Valid: | ||
{{analytics?.progress(testResult.Valid)}} | ||
</mat-chip> | ||
<mat-chip color="accent" selected> | ||
<!-- <mat-icon aria-hidden="false" aria-label="Example home icon">report_problem</mat-icon> --> | ||
Invalid: | ||
{{analytics?.progress(testResult.Invalid)}} | ||
</mat-chip> | ||
<mat-chip color="warn" selected> | ||
<!-- <mat-icon aria-hidden="false" aria-label="Example home icon">error</mat-icon> --> | ||
Error: | ||
{{analytics?.progress(testResult.Error)}} | ||
</mat-chip> | ||
</mat-chip-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ProgressComponent } from './progress.component'; | ||
|
||
describe('ProgressComponent', () => { | ||
let component: ProgressComponent; | ||
let fixture: ComponentFixture<ProgressComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ProgressComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ProgressComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { IQRCode, TestResultEnum, Analytics } from '../../interfaces/model.interface'; | ||
import { AppStore } from '../../stores/app.store'; | ||
|
||
@Component({ | ||
selector: 'app-progress', | ||
templateUrl: './progress.component.html', | ||
styleUrls: ['./progress.component.css'] | ||
}) | ||
export class ProgressComponent implements OnInit { | ||
public get value(): number { | ||
return !!this.analytics ? this.analytics.codes() : 0; | ||
} | ||
public get progress(): number { | ||
return !!this.analytics ? this.analytics.progress(null) : 0; | ||
} | ||
public get testResult(): typeof TestResultEnum { | ||
return TestResultEnum; | ||
} | ||
analytics: Analytics | null = null; | ||
|
||
constructor(private store: AppStore) { | ||
this.store.getSelected().subscribe((selected: IQRCode | null) => { | ||
this.update(); | ||
}); | ||
} | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
private update() { | ||
const qrcodes = this.store.getData().value; | ||
const results = this.store.getResults(); | ||
const analytcs = new Analytics(qrcodes, results); | ||
this.analytics = analytcs; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters