diff --git a/include/views.hpp b/include/views.hpp index d820ebc..aa551a5 100644 --- a/include/views.hpp +++ b/include/views.hpp @@ -272,6 +272,10 @@ inline auto filter_by_name(std::string_view name) { return std::views::filter([name] (const auto & account) { return account.name == name; }); } +inline auto filter_by_original_name(std::string_view name) { + return std::views::filter([name] (const auto & account) { return account.original_name == name; }); +} + inline auto filter_by_amount(budget::money amount) { return std::views::filter([amount] (const auto & element) { return element.amount == amount; }); } @@ -310,6 +314,16 @@ inline auto filter_by_date(budget::year year, budget::month month) { }); } +inline auto filter_by_date(budget::date date) { + return std::views::filter([date] (const T & element) -> bool { + if constexpr (std::is_same_v) { + return element == date; + } else { + return element.date == date; + } + }); +} + inline auto between(budget::month sm, budget::month month) { return std::views::filter([sm, month] (const T & element) -> bool { if constexpr (std::is_same_v) {