Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pay Periods - Query Methods / Properties #19

Closed
10 tasks done
jantman opened this issue Mar 21, 2017 · 3 comments
Closed
10 tasks done

Pay Periods - Query Methods / Properties #19

jantman opened this issue Mar 21, 2017 · 3 comments

Comments

@jantman
Copy link
Owner

jantman commented Mar 21, 2017

To enable the rest of the PayPeriod-related issues ( #34 #35 #36 #37 ), the PayPeriod object should have the following methods which take a db_session (a sqlalchemy.orm.scoping.scoped_session or a sqlalchemy.orm.session.Session) and return a sqlalchemy.orm.query.Query (we assume that in most cases we'll just be calling .all() on this Query, but we should return the Query itself for flexibility):

  • All active scheduled transactions for the period
  • All actual transactions for the period

And the following methods which take a db_session and return a dict or object to be used by something downstream:

  • each active recurring budget, along with the budget amount, allocated amount (amount of scheduled transactions or actual transactions this period), the spent amount and the remaining amount.
  • Total allocated (budgets plus transactions), total spent, total remaining
  • All transactions for the period; this should combine ScheduledTransactions and Transactions into one list, ordered by date, and return them as either objects or dicts in a common format so they can be displayed in one table. This is not going to be a DataTable, or at least is not going to be searchable/filterable/orderable; it will be a fixed representation.
    • Acceptance test for BiweeklyPayPeriod._dict_for_sched_trans() - set a budget start date at the beginning of the second week of a month, so we have a block of 3 consecutive pay periods, the first and last of which span month changes and the middle of which does not. Generate ~56 Monthly ScheduledTransactions on consecutive days, so we have transactions for at least one week on either side of the block of 3 consecutive pay periods. Ensure that each of the 3 pay periods contain the right transactions in the right order.
  • Need to exempt any ScheduledTransactions that have been converted to Transactions
  • How to handle scheduled income? See comment below

Also:

  • Given that a lot of the above use the same queries, we should explicitly cache the query results in the object.
  • For testing PayPeriod-related things (acceptance tests), biweeklybudget.settings_example.PAY_PERIOD_START_DATE should be set to the closest Friday to the current date.
@jantman jantman added triage and removed triage labels Mar 23, 2017
@jantman jantman mentioned this issue Mar 24, 2017
7 tasks
@jantman jantman added the ready label Apr 2, 2017
@jantman
Copy link
Owner Author

jantman commented Apr 3, 2017

Might be a good idea to split this up into some smaller issues...

@jantman
Copy link
Owner Author

jantman commented Apr 3, 2017

Split out most of this into: #34 #35 #36 #37

@jantman jantman changed the title Pay Period Display Pay Periods - Query Methods / Properties Apr 3, 2017
@jantman jantman added in progress and removed ready labels Apr 3, 2017
jantman added a commit that referenced this issue Apr 3, 2017
jantman added a commit that referenced this issue Apr 3, 2017
jantman added a commit that referenced this issue Apr 5, 2017
jantman added a commit that referenced this issue Apr 5, 2017
…action for the pay period, as well as method to get a list of all transactions as dicts, in display order
jantman added a commit that referenced this issue Apr 5, 2017
jantman added a commit that referenced this issue Apr 5, 2017
jantman added a commit that referenced this issue Apr 6, 2017
…ons from BiweeklyPayPeriod.transactions_list
jantman added a commit that referenced this issue Apr 6, 2017
…rn a dict of the budget amount, allocated amount and spent amount
jantman added a commit that referenced this issue Apr 6, 2017
…d spent). Need to figure out how to denote income.
jantman added a commit that referenced this issue Apr 6, 2017
@jantman
Copy link
Owner Author

jantman commented Apr 6, 2017

See #40 about income budgets. Need to update b164614 with that once finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant