Skip to content

Commit

Permalink
fix for multi channel in local measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
JavanXD committed Feb 17, 2020
1 parent 040e471 commit b832b25
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/app/components/measurement/measurement.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<ng-container *ngIf="measurement">
<pre class="pre-scrollable" *ngIf="debugInfo">{{debugInfo}}</pre>
<ul class="list-group" *ngIf="thingSpeakFields">
<ng-container *ngFor="let i of [1,2,3,4,5,6,7,8]">
<li *ngIf="thingSpeakFields['field' + i] || thingSpeakFields['field' + i] === 0.0"
<ng-container *ngFor="let n of numbers; let i = index">
<li *ngIf="thingSpeakFields['field' + (i+1)] || thingSpeakFields['field' + (i+1)] === 0.0" id="abc_{{n}}"
class="list-group-item">
<strong>{{'settings.thingspeak.field' | translate}} {{i}}</strong>: {{thingSpeakFields['field' + i]}}
<strong>{{'settings.thingspeak.field' | translate}} {{(i+1)}}</strong>: {{thingSpeakFields['field' + (i+1)]}}
</li>
</ng-container>
</ul>
Expand Down
6 changes: 5 additions & 1 deletion src/app/components/measurement/measurement.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export class MeasurementComponent implements OnInit {
public measurement;
public isLoading = false;
public noData = false;
public numbers;

constructor(private appService: AppService) { }
constructor(private appService: AppService) {
const maxLength = 8 * 10;
this.numbers = Array(maxLength).fill(0).map((x, i) => i);
}

ngOnInit() {
// this.getMeasurement();
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export class SettingsComponent implements OnInit {
if (!settings.internet) {
settings.internet = new InternetSettings();
}
if (!settings.sensors) {
settings.sensors = [];
}
return settings;
}

Expand Down

0 comments on commit b832b25

Please sign in to comment.