Skip to content
Snippets Groups Projects
Commit 4ba23281 authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

"Fixed FileHandBudget bug that prevented the application from loading an empty budget"

parent 83edf08c
No related branches found
No related tags found
10 merge requests!43Merging frontend-testing into master,!38"Made progressbar dynamic in accordance to spending. Added balance field....,!37Made the sub progress bars respond to changes in expense,!32Added input validation to add dialog boxes.,!30Redesigned scenes,!29Redesigned scenes,!28Redesigned scenes,!26Redesigned Main menu and expense/income windows,!24Merging frontend-testing with master,!23Merging frontend-testing and master
......@@ -192,13 +192,12 @@ public class BudgetController {
protected void refreshObservableList(){
budgetTableView.setItems(budgetList);
this.budgetList.setAll(general.getBudgetItems());
}
@FXML
public void switchScene(ActionEvent event) throws IOException {
//saveDataToFile("Budget");
saveDataToFile("Budget");
FXMLLoader loader = new FXMLLoader();
if (event.getSource() == expenseBtn) {
loader.setLocation(SceneController.class.getResource("/view/Expenses.fxml"));
......
......@@ -91,14 +91,10 @@ public class FileHandlingBudget {
} else if (line.startsWith(FileHandlingBudget.budgetDescription)) {
budgetDescription = line.replace(FileHandlingBudget.budgetDescription,"");
}
if ((line.isEmpty() || (nextLine == null)) /*&& (expenseCategory!=null)*/) {
if (line.isEmpty() || (nextLine == null)) {
if(generalBudget == null){
System.out.println("hello 1");
System.out.println(budgetPeriod);
generalBudget = new GeneralBudget(budgetPeriod,maxAmount);
generalBudget.addToBudget(budgetAmount,budgetDescription,expenseCategory);
} else{
System.out.println("hello2");
generalBudget.addToBudget(budgetAmount,budgetDescription,expenseCategory);
}
}
......
budgetPeriod=31
maxAmount=1000.0
budgetAmount=500.0
budgetCategory=FOOD
budgetDescription=dd
......@@ -10,9 +10,3 @@ amount=121.0
isRecurring=Not recurring
category=OTHER
date=2024-03-16
description=1112111
amount=1000.0
isRecurring=Not recurring
category=FOOD
date=2023-03-24
description=studie
amount=1000.0
isRecurring=Recurring
category=STUDENT_LOAN
date=2023-03-25
amount=100.0
isRecurring=Not recurring
category=GIFT
date=2023-03-25
description=airbnb
amount=3000.0
isRecurring=Not recurring
category=GIFT
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment