From 1314b9a82265afa0f643dd5081ae45d08cfdfce6 Mon Sep 17 00:00:00 2001 From: abdellah Date: Thu, 3 Nov 2022 19:30:45 +0100 Subject: [PATCH] Code cleanup --- src/app/voting/voting.component.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/app/voting/voting.component.ts b/src/app/voting/voting.component.ts index 9d31991..bb7d226 100644 --- a/src/app/voting/voting.component.ts +++ b/src/app/voting/voting.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { map, Observable } from 'rxjs'; +import { map } from 'rxjs'; import { CandidatesService } from '../services/candidates.service'; import { Candidate } from '../models/candidate.model'; import { VotesService } from '../services/votes.service'; @@ -17,15 +17,7 @@ export class VotingComponent implements OnInit { candidates!: any[]; groupedCandidates: Candidate[][] = []; groupedVotedCandidates: number[] = [];; - votedGroups: number[] = []; votesCount: number=0; - public candidatestoshow: any; - public rows!: Observable; - private currentVoteID: any; - primes!: number[]; - items: any; - totalVoteData: any; - downloadJsonHref: any; candidatesCount: number = 0; @@ -74,13 +66,11 @@ export class VotingComponent implements OnInit { if(this.groupedVotedCandidates[candidate.group] == undefined) { this.groupedVotedCandidates[candidate.group] = candidate.candidateID; - //candidate.votes++; + //candidate.votes++;//not needed since the votes are updated in realtime once changed on the firestore DB this.candidatesService.addVote(candidate); this.voteService.vote(candidate.candidateID); } - this.localStorageService.saveData('groupedVotedCandidates',JSON.stringify(this.groupedVotedCandidates)); - } getCandidateClass(group: number, id: number) {