Skip to content

Commit

Permalink
fix(intg): exclude % when saving current entry
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Jan 23, 2023
1 parent f374c6b commit 60adbd4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/CalculatorContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,15 @@ function addToHistoryList() {
function retrieveEvaluationResults(newEvaluation: Evaluations, result: number) {
mustClearEntryOnNextAppend.value = true
const mustSaveCurrentEntry = newEvaluation === "1/x"
|| newEvaluation === ""
|| newEvaluation === ""
const mustSaveCurrentEntry = newEvaluation !== "="
previousExpressionEvaluated.value = expressionToEvaluate.value
if (!lastPassedEntry.value) {
const [ leftOperand, unusedRightOperand ] = previousExpressionEvaluated.value.split(operation.value as Operations)
lastPassedEntry.value = Number(leftOperand)
}
if (hasSavedPreviousResult.value) expressionToEvaluate.value = `${previousResult.value}${operation.value}${lastPassedEntry.value}`
if (mustSaveCurrentEntry) previousEntry.value = Number(entry.value)
if (mustSaveCurrentEntry && newEvaluation !== "%") previousEntry.value = Number(entry.value)
evaluation.value = newEvaluation
previousResult.value = String(result)
Expand Down

0 comments on commit 60adbd4

Please sign in to comment.