Git Product home page Git Product logo

allowance-tracker's Introduction

allowance-tracker

Our family's allowance policy is that the kids get a dollar a day by default, but allowance is withheld for bad behavior. This app enables easy updating of transactions as well as allowing the kids to self-check how much money is in their account.

This is my first rails project so I'm using it to learn rails too.

To deploy

You can deploy locally for testing:

bin/rails server

I use heroku to deploy to the public cloud:

git push heroku main

After a DB migration, do

heroku run rails db:migrate
heroku restart

The restart seems to be important.. until you do that things are not in a good state.

You can also deploy locally via heroku:

heroku local

Getting started

You need to add an account for each kid. There is no UI interface for this, so here's how to do it:

bin/rails console (or heroku run rails console)
account = Account.new(name:'Remi')
account.save

You also need to add an admin user so that you can edit transactions. Anyone who knows the login/password will be able to edit the transactions, so it's important the kids don't know it.

user = User.new(login:'x', password:'xxx',active:true,approved:true,confirmed:true)
user.save

If the transaction rollbacks, you can do user.errors to see what's wrong.

How to use

Once you access the app, go to the kid's account. Sign in with the admin credentials to access the "New transaction" and "New incrementor" controls. First, add a new incrementor. Give it a start date, an increment per day (e.g., 1), and a comment. That will be the default allowance given every day.

If you ever want to boost allowance, or deduct allowance when the kids decide to buy something, add a new transaction.

But if you want to withhold allowance, add a new transaction and check the box for "withhold increment today." In this case the amount is ignored.

There is an intentional subtle difference between withholding the increment for a day and simply having a transaction for -$1 in the way it shows up in the "virtual transactions" list. I want the kids to understand that allowance is withheld as a consequence for bad behavior, instead of earning an allowance by default which is then canceled out with a penalty deduction.

Misc notes

I generated the Account and Transaction models out of order, so Transaction was missing a reference to account. So here's how to fix that. https://stackoverflow.com/questions/4338973/adding-a-model-reference-to-existing-rails-model/16354869#16354869

rails generate migration AddAccountRefToTransaction account:references

allowance-tracker's People

Contributors

esirko avatar

Watchers

 avatar

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.