From 284dc41ac93d310c79765cf113116ec12783f8fe Mon Sep 17 00:00:00 2001 From: Marcel Mernitz <marcel.mernitz@informatik.uni-halle.de> Date: Tue, 15 Dec 2020 10:41:17 +0100 Subject: [PATCH] Delete application.js --- week03/app/controllers/application.js | 70 --------------------------- 1 file changed, 70 deletions(-) delete mode 100644 week03/app/controllers/application.js diff --git a/week03/app/controllers/application.js b/week03/app/controllers/application.js deleted file mode 100644 index 75034cd..0000000 --- a/week03/app/controllers/application.js +++ /dev/null @@ -1,70 +0,0 @@ -import Controller from '@ember/controller'; -import { tracked } from '@glimmer/tracking'; -import { action } from '@ember/object'; - -export default class ApplicationController extends Controller { - @tracked a; - @tracked b; - @tracked operator = "+"; - @tracked result; - @tracked calculated = false; - @tracked historyAvailable = false; - @tracked calculationsList = []; - - @action - calculate(event) { - event.preventDefault(); - if (this.operator === "+") { - this.result = parseInt(this.a) + parseInt(this.b); - this.calculated = true; - this.calculationsList.pushObject({calc: `${this.a} ${this.operator} ${this.b} = ${this.result}`}); - console.log(`list: ${this.calculationsList}`) - this.historyAvailable = true; - console.log(`a: ${this.a}, b: ${this.b}, operator: ${this.operator}, result: ${this.result}, calculated: ${this.calculated}`) - } else if (this.operator === "-") { - this.result = parseInt(this.a) - parseInt(this.b); - this.calculated = true; - this.calculationsList.pushObject({calc: `${this.a} ${this.operator} ${this.b} = ${this.result}`}); - console.log(`list: ${this.calculationsList}`) - this.historyAvailable = true; - console.log(`a: ${this.a}, b: ${this.b}, operator: ${this.operator}, result: ${this.result}, calculated: ${this.calculated}`) - } else if (this.operator === "*") { - this.result = parseInt(this.a) * parseInt(this.b); - this.calculated = true; - this.calculationsList.pushObject({calc: `${this.a} ${this.operator} ${this.b} = ${this.result}`}); - console.log(`list: ${this.calculationsList}`) - this.historyAvailable = true; - console.log(`a: ${this.a}, b: ${this.b}, operator: ${this.operator}, result: ${this.result}, calculated: ${this.calculated}`) - }else if (this.operator === "%") { - this.result = parseInt(this.a) % parseInt(this.b); - this.calculated = true; - this.calculationsList.pushObject({calc: `${this.a} ${this.operator} ${this.b} = ${this.result}`}); - console.log(`list: ${this.calculationsList}`) - this.historyAvailable = true; - console.log(`a: ${this.a}, b: ${this.b}, operator: ${this.operator}, result: ${this.result}, calculated: ${this.calculated}`) - } else if (this.operator === "/" && parseInt(this.b) !== 0) { - this.result = parseInt(this.a) / parseInt(this.b); - this.calculated = true; - this.calculationsList.pushObject({calc: `${this.a} ${this.operator} ${this.b} = ${this.result}`}); - console.log(`list: ${this.calculationsList}`) - this.historyAvailable = true; - console.log(`a: ${this.a}, b: ${this.b}, operator: ${this.operator}, result: ${this.result}, calculated: ${this.calculated}`) - } - - } - - @action - setNewOperator(value) { - this.operator = value; - } - - @action - recalculate(params) { - let splitted = params.split(" "), arr = []; - console.log(splitted) - this.a = splitted[0]; - this.operator = splitted[1]; - this.b = splitted[2]; - this.calculate(event); - } -} -- GitLab