GithubHelp home page GithubHelp logo

dreikanter / boodka Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 3.0 1.76 MB

Experimental personal budget calculator

License: MIT License

Ruby 68.18% JavaScript 3.09% CSS 3.57% HTML 18.96% TSQL 6.19%
budget budget-management multi-currency currency-exchange

boodka's People

Contributors

dependabot[bot] avatar dreikanter avatar egarieva2 avatar laaisee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

boodka's Issues

BudgetCategory model

Budget item is a single category for the Budget

  • budget_id
  • category_id
  • planned_amount
  • planned_currency
  • description
  • order
  • belongs_to budget

Budget view

  • Any number of BudgetItems
  • "Add" button
  • "Drop" button in each row
  • Budget form layout should correspond to the #show view
  • Columns for the show view: Category, Budgeted, Outflow, Balance
  • Columns for the new view: Category, Budgeted, Memo
  • Edit view form shows full table, with calculated fields in r/o mode

Transfers

  • Source account
  • Destination account
  • Amount
  • Currency
  • Timestamp (datepicker)

Update budget

    $(".budget-cell").focus(function() {
      var cell = $(this);
      $.ajax({
        url: $(this).data("path"),
        success: function(data) {
          cell.val(data["budget_category"]["planned"]);
        }
      });
    });

    $(".budget-cell").blur(function() {
      var cell = $(this);
      $.ajax({
        url: $(this).data("path"),
        type: "PATCH",
        data: { value: cell.val() },
        beforeSend: function() {
          cell.css("background-color", "yellow");
        },
        success: function() {
          cell.css("background-color", "transparent");
        }
      });
    });

Convert Transaction#amount during creation

  • Convert from Transaction#currency to Account#currency
  • Use recent rates
  • Don't hit rates provider if Transaction#currency == Account#currency (set rate to 1.0)
  • Save rate to DB table
  • Update calculated value on record update
  • Don't update rate on record update

Rates

  • Manual download on demand
  • Show on separate page

Show form errors

  • Flash
  • Inline messages
  <div class="form-group<%= ' has-error' if @form.errors[:amount] %>">
    <%= form.label :amount, class: 'control-label' %>
    <%= form.text_field :amount, placeholder: 'Amount', class: 'form-control', autofocus: true %>
    <% if @form.errors[:amount] %>
      <span class="help-block"><%= @form.errors[:amount].join(', ') %></span>
    <% end %>
  </div>

Auto annotations

auto_annotate.rb:

# NOTE: only doing this in development as some production environments (Heroku)
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
# NOTE: to have a dev-mode tool do its thing in production.
if Rails.env.development?
  task :set_annotation_options do
    # You can override any of these by setting an environment variable of the
    # same name.
    Annotate.set_defaults({
      'position_in_routes'   => "before",
      'position_in_class'    => "before",
      'position_in_test'     => "before",
      'position_in_fixture'  => "before",
      'position_in_factory'  => "before",
      'show_indexes'         => "true",
      'simple_indexes'       => "false",
      'model_dir'            => "app/models",
      'include_version'      => "false",
      'require'              => "",
      'exclude_tests'        => "false",
      'exclude_fixtures'     => "false",
      'exclude_factories'    => "false",
      'ignore_model_sub_dir' => "false",
      'skip_on_db_migrate'   => "false",
      'format_bare'          => "true",
      'format_rdoc'          => "false",
      'format_markdown'      => "false",
      'sort'                 => "false",
      'force'                => "false",
      'trace'                => "false",
    })
  end

  Annotate.load_tasks
end

Transaction type

  • Enum field: Inflow/Outflow
  • Add a switch to the view
  • Add a marker to the table items
  • Update Account#total calculation

Budget model

"Budget" is a budgeting period record.

  • started_at
  • finished_at
  • description
  • has_many budget_items

Calculate current amount of money for account

  • Pick from latest Reconciliation (LR) for the Account (A)
  • Use "null" Reconciliation for LR, with amount: 0 and created_at: Transaction.first.created_at, if there are no Reconciliation record for A.
  • Pick all Transactions (Ts) for A, where created_at > LR.created_at
  • Result is LR.amount + sum(Ts.map { T.converted_amount(Account.currency, Rate.closest_to(T.created_at)) })

Metacategories

  • Category belongs_to Metacategory
  • Metacategory has_may Categories
  • Editor near the Categories view

consider migrating to Postgres

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5
  host: localhost
  port: 5432

development:
  <<: *default
  database: "<%= ENV['app_name'] %>_development"

test:
  <<: *default
  database: "<%= ENV['app_name'] %>_test"

production:
  <<: *default
  host: "<%= ENV['postgres_host'] %>"
  port: "<%= ENV['postgres_port'] %>"
  database: "<%= ENV['app_name'] %>"
  username: "<%= ENV['postgres_username'] %>"
  password: "<%= ENV['postgres_password'] %>"

staging:
  <<: *default
  host: "<%= ENV['postgres_host'] %>"
  port: "<%= ENV['postgres_port'] %>"
  database: "<%= ENV['postgres_database'] %>"
  username: "<%= ENV['postgres_username'] %>"
  password: "<%= ENV['postgres_password'] %>"

Batch category editor

  • Categories#index โ€” shows the full list of categories
  • Categories#edit โ€” opens a dynamic form to edit categories list

Update cells

  • Create BC if not exists
  • Create Budget if not exists
  • Use callbacks
  • Drop BC after Budget

Budget scaffold

  • Scaffold
  • URL uses Year and Month
  • Empty page if there is no Budget record for the date
  • "Create budget" action on empty page
  • "Reuse last month budget" action on empty page
  • Show "Edit budget" button after it was created
  • Show full list of transactions on the month page
  • Show a row of buttons for each month of the year
  • Previous year button linked to PreviousYear/December
  • Next year button linked to NextYear/January
  • Current month is highlighted
  • Current page month is highlighted too
  • Memo for budgeting period

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.