Skip to content

Commit

Permalink
fix(intg): update expression
Browse files Browse the repository at this point in the history
This occurs if the state `hasSavedPreviousResult`
  • Loading branch information
lemredd committed Jan 5, 2023
1 parent 95adf84 commit 9920a6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/CalculatorContainer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref } from "vue"
import { computed, reactive, ref } from "vue"
import type {
Entries,
Expand Down Expand Up @@ -199,6 +199,8 @@ function evaluateExpression(evaluationMethod: Evaluations) {
function retrieveEvaluationResults(newEvaluation: Evaluations, result: number) {
if (!previousExpressionEvaluated.value) previousExpressionEvaluated.value = expressionToEvaluate.value
if (hasSavedPreviousResult.value) expressionToEvaluate.value = `${previousResult.value}${operation.value}${rightEntry.value}`
evaluation.value = newEvaluation
previousResult.value = String(result)
entry.value = String(result)
Expand Down Expand Up @@ -259,6 +261,7 @@ function retrieveEvaluationResults(newEvaluation: Evaluations, result: number) {
<EvaluationButton
value="="
:expression-to-evaluate="expressionToEvaluate"
:expression-and-previous-result-information="expressionAndPreviousResultInformation"
@emit-evaluation-result="retrieveEvaluationResults"
/>
</div>
Expand Down

0 comments on commit 9920a6d

Please sign in to comment.