Giter Club home page Giter Club logo

mealz's People

Contributors

lewis-fidlers avatar reprazent avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

lewis-fidlers

mealz's Issues

Canceling a meal

Meals should become canceled:

  • Save a canceled_at date
  • Recalculate the balance for all users
  • Delete wrongly created users (if the user has no mealz left after deleting)
m.users.each do |eater|
  eater.balance -= m.amount if eater == m.payed_by
  eater.balance += m.amount / m.users.count
  eater.save!
end

This could go in a new seperate MealDestroyer

Archiving users

Saving when a user was archived.

  • When a user is archived it is no longer counted for in the balances
  • Adding a meal with an archived user, unarchives him

Ledgeresque bookkeeping

Do a double bookkeeping system, so keep track of outgoing payments and incoming payments. That way we're always up to date with the balances and calculating them will be a snap.

Things left as an exercise for the reader:

  • [] Think of a way to keep track of current balance state
  • [] Make code below do actual things
class Mealz
# Van elke user per maaltijd
  has_many :incoming_payments

# Winkel en de user die is gaan halen
  has_many :outgoing_payments

  payment :reason
end

class Payment
      belongs_to :user
      belongs_to :meal

# amount
# reason
# kind
end

# Bob en Piet eten mee
# Bob is eten halen

OutgoingPayment.new(user: bob, 30, reason: "shopping")
IncomingPayment.new(user: piet, 30/2, reason: "eating")
IncomingPayment.new(user: bob, 30/2, reason: "eating")

Create a meal before in advance

Creating a meal in advance would allow people to subscribe to it.
So a meal would then have many users trough a request, request can have an extra "requests" property.
Saying something like ik eet mee: oude kaas, stokbrood would create a meal without a payer/amount/... if none exists, or add the request to an already existing meal.

This would need #5 to be done first, so we can cancel a meal if we later on decide not to go.

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.