Skip to content

Commit

Permalink
Simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
wichtounet committed Oct 5, 2023
1 parent 4f9c4ac commit 9198420
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
8 changes: 1 addition & 7 deletions src/liabilities.cpp
Expand Up @@ -404,13 +404,7 @@ void budget::show_liabilities(budget::writer& w){
}

bool budget::liability::is_fi() const {
for (const auto& [class_id, alloc] : classes) {
if (get_asset_class(class_id).fi) {
return true;
}
}

return false;
return std::ranges::any_of(classes, [](auto & c) { return get_asset_class(c.first).fi; });
}

bool budget::liability_exists(size_t id){
Expand Down
4 changes: 2 additions & 2 deletions src/money.cpp
Expand Up @@ -82,8 +82,8 @@ budget::money budget::random_money(long min, long max){
static std::random_device rd;
static std::mt19937_64 engine(rd());

std::uniform_int_distribution<long> dollars_dist(min, max);
std::uniform_int_distribution<int> cents_dist(0, 99);
std::uniform_int_distribution dollars_dist(min, max);
std::uniform_int_distribution cents_dist(0, 99);

return {dollars_dist(engine), cents_dist(engine)};
}
Expand Down
2 changes: 1 addition & 1 deletion src/retirement.cpp
Expand Up @@ -214,7 +214,7 @@ void budget::retirement_status(budget::writer& w) {
contents.push_back({""s, ""s});
contents.push_back({"Current Withdrawal Rate"s, to_string(100.0 * (expenses / nw)) + "%"});
contents.push_back({"Months of FI"s, to_string(nw / (expenses / 12))});
contents.push_back({"Years of FI"s, to_string(nw / (expenses))});
contents.push_back({"Years of FI"s, to_string(nw / expenses)});

contents.push_back({""s, ""s});
contents.push_back({"Current Yearly Allowance"s, to_string(nw * (wrate / 100.0))});
Expand Down

0 comments on commit 9198420

Please sign in to comment.