From 46e7a580c6eee5277f0dc84cb23b7dd7cc0b2ba7 Mon Sep 17 00:00:00 2001 From: kj1352 Date: Wed, 14 Apr 2021 17:04:07 +0530 Subject: [PATCH] Removed faker JS package --- package.json | 1 - src/app/add-party/add-party.page.ts | 11 ---- src/app/booking/booking.page.ts | 45 +-------------- src/app/chat/chat.page.ts | 89 ----------------------------- src/app/quiz/quiz.page.ts | 1 - 5 files changed, 1 insertion(+), 146 deletions(-) diff --git a/package.json b/package.json index b117070..75f9e73 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "cordova-res": "^0.15.2", "es6-promise-plugin": "^4.2.2", "face-api.js": "^0.22.2", - "faker": "^5.1.0", "hammerjs": "^2.0.8", "moment": "^2.29.1", "rxjs": "~6.5.5", diff --git a/src/app/add-party/add-party.page.ts b/src/app/add-party/add-party.page.ts index a8c1f9d..aac8c9c 100644 --- a/src/app/add-party/add-party.page.ts +++ b/src/app/add-party/add-party.page.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import * as faker from 'faker'; import { ModalController } from '@ionic/angular'; @Component({ @@ -40,16 +39,6 @@ export class AddPartyPage implements OnInit { ngOnInit() { - for (let i = 0; i < 12; i += 1) { - this.contactList.push({ - name: faker.name.findName(), - phone: faker.phone.phoneNumber() - }); - } - - this.tempContactList = JSON.parse(JSON.stringify(this.contactList)); - - } searchContact() { diff --git a/src/app/booking/booking.page.ts b/src/app/booking/booking.page.ts index 934a694..0c10445 100644 --- a/src/app/booking/booking.page.ts +++ b/src/app/booking/booking.page.ts @@ -1,6 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { IonSlides, ModalController } from '@ionic/angular'; -import * as faker from 'faker'; import * as moment from 'moment'; import { Router } from '@angular/router'; import { ChatPage } from '../chat/chat.page'; @@ -93,49 +92,7 @@ export class BookingPage implements OnInit { } ngOnInit() { - for (let i = 0; i < 3; i += 1) { - this.bookingSeatsData.push({ - dateTime: faker.date.future(), - staduim : this.stadiums[i], - matchType: 'T20 League', - matchDetails: { - home: i !==1 ? this.teams[i] : { name: 'KXIP', image: 'assets/home-team/KXIP.svg' }, - away: i ===1 ? this.teams[i] : { name: 'KXIP', image: 'assets/home-team/KXIP.svg' } - }, - seatsAvailable: [{ - stand: 'Grand', - seats: [], - }, { - stand: 'Pavilion', - seats: [], - }, { - stand: 'First', - seats: [], - }, { - stand: 'Second', - seats: [], - }] - }); - } - - for (let i = 0; i < this.bookingSeatsData.length; i += 1) { - for (let j = 0; j < this.bookingSeatsData[i].seatsAvailable.length; j += 1) { - - let price = faker.commerce.price(); - - let randomNumber = Math.random() * (15 - 0); - - for (let k = 0; k < randomNumber; k += 1) { - this.bookingSeatsData[i].seatsAvailable[j].seats.push({ - id: this.bookingSeatsData[i].seatsAvailable[j].stand + '##' + k.toString(), - price - }); - } - } - } - - this.selectedDate = this.bookingSeatsData[0].dateTime; - + } diff --git a/src/app/chat/chat.page.ts b/src/app/chat/chat.page.ts index 5d1eab9..7cc56e7 100644 --- a/src/app/chat/chat.page.ts +++ b/src/app/chat/chat.page.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from '@angular/core'; import { ModalController } from '@ionic/angular'; -import * as faker from 'faker'; import { ToastController } from '@ionic/angular'; @@ -68,94 +67,6 @@ export class ChatPage implements OnInit { } ngOnInit() { - - let myAccountIndex = Math.floor(Math.random() * 11); - - for (let i = 0; i < 12; i += 1) { - this.members.push({ - name: myAccountIndex === i ? 'You' : faker.name.findName(), - image: 'assets/home-team/roster/' + (i + 1) + '.png', - color: faker.vehicle.color() - }); - } - - this.myAccount = this.members[myAccountIndex]; - - - for (let i = 0; i < 2; i += 1) { - let options = []; - - for (let j = 0; j < 4; j += 1) { - options.push({ - text: faker.lorem.word(), - pollUserCount: faker.random.number() - }); - } - - let ballChat = []; - - for (let balls = 0; balls < 6; balls += 1) { - let randomNumber = Math.floor(Math.random() * 3) + 1; - let chat = []; - - for (let k = 0; k < randomNumber; k += 1) { - let randomMemberIndex = Math.floor(Math.random() * 3); - chat.push({ - user: this.members[randomMemberIndex], - text: faker.lorem.sentence(), - time: faker.time.recent(), - }); - } - - ballChat.push({ - ball: balls, - chat: chat - }); - } - - this.chatData.push({ - over: i, - ballChat: ballChat, - triviaQuestion: { - question: faker.lorem.sentence(), - maxUserCount: Math.max.apply(Math, options.map(function(o) { return o.pollUserCount; })), - options: options, - selectedAnswer: Math.floor(Math.random() * 4), - } - }); - } - - setTimeout(() => { - let options = []; - - for (let j = 0; j < 4; j += 1) { - options.push({ - text: faker.lorem.word(), - pollUserCount: faker.random.number() - }); - } - - this.chatData.push({ - over: this.chatData.length - 1, - ballChat: [{ - ball: 0, - chat: [], - }], - triviaQuestion: { - question: faker.lorem.sentence(), - maxUserCount: Math.max.apply(Math, options.map(function(o) { return o.pollUserCount; })), - options: options, - selectedAnswer: null, - } - }); - - setTimeout(() => { - this.scrollToEnd(); - }, 1000); - - - }, 200); - } scrollToEnd() { diff --git a/src/app/quiz/quiz.page.ts b/src/app/quiz/quiz.page.ts index 574da93..c7afaa3 100644 --- a/src/app/quiz/quiz.page.ts +++ b/src/app/quiz/quiz.page.ts @@ -1,5 +1,4 @@ import { Component, OnInit } from '@angular/core'; -import * as faker from 'faker'; import { Location } from '@angular/common'; @Component({