Skip to content

Commit

Permalink
worked on the remaining amount functionality for a budget and total a…
Browse files Browse the repository at this point in the history
…mount table
  • Loading branch information
ibilalkayy committed May 29, 2024
1 parent 3964db1 commit 8bede71
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/spf13/cobra"
)

const version = "v0.1.112"
const version = "v0.1.113"

// rootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion framework/db/budget_db/budget_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (h MyBudgetDB) CreateBudget(bv *entities.BudgetVariables) error {

for i := 0; i < len(includedCategory); i++ {
if len(bv.Category) != 0 && len(includedCategory) != 0 && includedCategory[i][0] == bv.Category && fullTotalAmount != 0 && totalBudgetAmount+bv.Amount <= fullTotalAmount {
_, err = insert.Exec(bv.Category, bv.Amount, 0, 0)
_, err = insert.Exec(bv.Category, bv.Amount, 0, bv.Amount)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion framework/db/budget_db/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (MyBudgetDB) CalculateRemaining(details [4]int) ([2]int, error) {
if details[2] <= details[0] {
details[3] = details[0] - details[2]
} else {
details[2] = details[0]
details[2] = 0
details[3] = 0
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion usecases/app/total_amount/total_amount.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (h MyTotalAmount) SetTotalAmount(totalAmount int, include_category, label s
tav := entities.TotalAmountVariables{
TotalAmount: totalAmount,
SpentAmount: 0,
RemainingAmount: 0,
RemainingAmount: totalAmount,
Status: "inactive",
}

Expand Down

0 comments on commit 8bede71

Please sign in to comment.