Idk, updated something
This commit is contained in:
parent
3c40566094
commit
4b65d7417f
2 changed files with 27 additions and 19 deletions
|
@ -17,26 +17,31 @@ public struct Budget: Identifiable, Hashable, Codable {
|
||||||
public struct BudgetOverview: Equatable {
|
public struct BudgetOverview: Equatable {
|
||||||
public let budget: Budget
|
public let budget: Budget
|
||||||
public let balance: Int
|
public let balance: Int
|
||||||
public var maxValue: Float {
|
public let transactionCount: Int
|
||||||
get {
|
public let categories: [Category]
|
||||||
return Float(max(
|
public var expectedIncome: Float
|
||||||
max(expectedIncome, actualIncome),
|
public var actualIncome: Float
|
||||||
max(expectedExpenses, actualExpenses)
|
public var expectedExpenses: Float
|
||||||
))
|
public var actualExpenses: Float
|
||||||
}
|
|
||||||
}
|
|
||||||
public var expectedIncome: Int
|
|
||||||
public var actualIncome: Int
|
|
||||||
public var expectedExpenses: Int
|
|
||||||
public var actualExpenses: Int
|
|
||||||
|
|
||||||
public init(budget: Budget, balance: Int, expectedIncome: Int = 0, actualIncome: Int = 0, expectedExpenses: Int = 0, actualExpenses: Int = 0) {
|
public init(
|
||||||
|
budget: Budget,
|
||||||
|
balance: Int,
|
||||||
|
categories: [Category],
|
||||||
|
transactionCount: Int,
|
||||||
|
expectedIncome: Int = 0,
|
||||||
|
actualIncome: Int = 0,
|
||||||
|
expectedExpenses: Int = 0,
|
||||||
|
actualExpenses: Int = 0
|
||||||
|
) {
|
||||||
self.budget = budget
|
self.budget = budget
|
||||||
self.balance = balance
|
self.balance = balance
|
||||||
self.expectedIncome = expectedIncome
|
self.categories = categories
|
||||||
self.actualIncome = actualIncome
|
self.transactionCount = transactionCount
|
||||||
self.expectedExpenses = expectedExpenses
|
self.expectedIncome = Float(expectedIncome) / 100.0
|
||||||
self.actualExpenses = actualExpenses
|
self.actualIncome = Float(actualIncome) / 100.0
|
||||||
|
self.expectedExpenses = Float(expectedExpenses) / 100.0
|
||||||
|
self.actualExpenses = Float(actualExpenses) / 100.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,6 +392,9 @@ public class RequestHelper {
|
||||||
return try self.decoder.decode(ResultType.self, from: data)
|
return try self.decoder.decode(ResultType.self, from: data)
|
||||||
} catch {
|
} catch {
|
||||||
print("error decoding json: \(error)")
|
print("error decoding json: \(error)")
|
||||||
|
if let data = data {
|
||||||
|
print(String(decoding: data, as: UTF8.self))
|
||||||
|
}
|
||||||
throw NetworkError.jsonParsingFailed(error)
|
throw NetworkError.jsonParsingFailed(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue