Skip to content

Instantly share code, notes, and snippets.

@almet almet/ihatemoney-stats.py
Last active Jan 13, 2019

Embed
What would you like to do?
ihatemoney stats
# IHATEMONEY_SETTINGS_FILE_PATH=/home/ihatemoney/ihatemoney.org/ihatemoney.cfg ./ihatemoney.org/venv/bin/ihatemoney shell
>>> # To know the number of projects with more than 10 bills and less than 3 months old.
>>> from ihatemoney.models import *; import datetime
>>> projects = [pr for pr in Project.query.all() if pr.get_bills().count() > 10 and pr.get_bills()[0].date > datetime.date.today() - datetime.timedelta(days=90)]
>>> len(projects)
>>> # To get the email of the contacts
>>> ", ".join(set([pr.contact_email for pr in projects]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.