mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 05:01:48 +02:00
Compare commits
3 commits
40fd353f95
...
2d2a773f71
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2d2a773f71 | ||
![]() |
cf77b4c346 | ||
![]() |
a90999b4bb |
40 changed files with 123 additions and 39 deletions
|
@ -4,6 +4,7 @@ import getpass
|
|||
import os
|
||||
import random
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
import click
|
||||
from flask.cli import FlaskGroup
|
||||
|
@ -93,5 +94,31 @@ def delete_project(project_name):
|
|||
db.session.commit()
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("print_emails", default=False)
|
||||
@click.argument("bills", default=0) # default values will get total projects
|
||||
@click.argument("days", default=73000) # approximately 200 years
|
||||
def get_project_count(print_emails, bills, days):
|
||||
"""Count projets with at least x bills and at less than x days old"""
|
||||
projects = [
|
||||
pr
|
||||
for pr in Project.query.all()
|
||||
if pr.get_bills().count() > bills
|
||||
and pr.get_bills()[0].date
|
||||
> datetime.date.today() - datetime.timedelta(days=days)
|
||||
]
|
||||
click.secho("Number of projects: " + str(len(projects)))
|
||||
|
||||
if print_emails:
|
||||
emails = set([pr.contact_email for pr in projects])
|
||||
emails_str = ", ".join(emails)
|
||||
if len(emails) > 1:
|
||||
click.secho("Contact emails: " + emails_str)
|
||||
elif len(emails) == 1:
|
||||
click.secho("Contact email: " + emails_str)
|
||||
else:
|
||||
click.secho("No contact emails found")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
|
|
|
@ -759,7 +759,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
<i class="icon book">{{ static_include("images/book.svg") | safe }}</i>
|
||||
</a>
|
||||
{% if g.show_admin_dashboard_link %}
|
||||
<a target="_blank" rel="noopener" data-toggle="tooltip" data-placement="top" title="{{ _('Administation Dashboard') }}" href="{{ url_for('main.dashboard') }}">
|
||||
<a target="_blank" rel="noopener" data-toggle="tooltip" data-placement="top" title="{{ _('Administration Dashboard') }}" href="{{ url_for('main.dashboard') }}">
|
||||
<i class="icon admin">{{ static_include("images/cog.svg") | safe }}</i>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -9,7 +9,12 @@ from werkzeug.security import check_password_hash
|
|||
|
||||
from ihatemoney import models
|
||||
from ihatemoney.currency_convertor import CurrencyConverter
|
||||
from ihatemoney.manage import delete_project, generate_config, password_hash
|
||||
from ihatemoney.manage import (
|
||||
delete_project,
|
||||
generate_config,
|
||||
get_project_count,
|
||||
password_hash,
|
||||
)
|
||||
from ihatemoney.run import load_configuration
|
||||
from ihatemoney.tests.common.ihatemoney_testcase import BaseTestCase, IhatemoneyTestCase
|
||||
|
||||
|
@ -229,6 +234,58 @@ class TestModels(IhatemoneyTestCase):
|
|||
pay_each_expected = 10 / 3
|
||||
assert bill.pay_each() == pay_each_expected
|
||||
|
||||
def test_demo_project_count(self):
|
||||
"""Test command the get-project-count"""
|
||||
self.post_project("raclette")
|
||||
|
||||
# add members
|
||||
self.client.post("/raclette/members/add", data={"name": "zorglub", "weight": 2})
|
||||
self.client.post("/raclette/members/add", data={"name": "fred"})
|
||||
self.client.post("/raclette/members/add", data={"name": "tata"})
|
||||
self.client.post("/raclette/members/add", data={"name": "pépé"})
|
||||
|
||||
# create bills
|
||||
self.client.post(
|
||||
"/raclette/add",
|
||||
data={
|
||||
"date": "2011-08-10",
|
||||
"what": "fromage à raclette",
|
||||
"payer": 1,
|
||||
"payed_for": [1, 2, 3],
|
||||
"amount": "10.0",
|
||||
},
|
||||
)
|
||||
|
||||
self.client.post(
|
||||
"/raclette/add",
|
||||
data={
|
||||
"date": "2011-08-10",
|
||||
"what": "red wine",
|
||||
"payer": 2,
|
||||
"payed_for": [1],
|
||||
"amount": "20",
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEqual(self.get_project("raclette").has_bills(), True)
|
||||
|
||||
runner = self.app.test_cli_runner()
|
||||
result0 = runner.invoke(get_project_count)
|
||||
self.assertEqual(result0.output.strip(), "Number of projects: 1")
|
||||
result1 = runner.invoke(get_project_count, "False 1")
|
||||
self.assertEqual(result1.output.strip(), "Number of projects: 1")
|
||||
result2 = runner.invoke(get_project_count, "False 2")
|
||||
self.assertEqual(result2.output.strip(), "Number of projects: 0")
|
||||
result3 = runner.invoke(get_project_count, "False 0 0")
|
||||
self.assertEqual(result3.output.strip(), "Number of projects: 0")
|
||||
result4 = runner.invoke(get_project_count, "False 0 20000")
|
||||
self.assertEqual(result4.output.strip(), "Number of projects: 1")
|
||||
result4 = runner.invoke(get_project_count, "True")
|
||||
self.assertEqual(
|
||||
result4.output.strip(),
|
||||
"Number of projects: 1\nContact email: raclette@notmyidea.org",
|
||||
)
|
||||
|
||||
|
||||
class TestEmailFailure(IhatemoneyTestCase):
|
||||
def test_creation_email_failure_smtp(self):
|
||||
|
|
|
@ -782,7 +782,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -785,7 +785,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -826,7 +826,7 @@ msgstr "Aplicació mòbil"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentació"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Panell d'administració"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -800,7 +800,7 @@ msgstr "Mobilní aplikace"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentace"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Správcovský panel"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -824,7 +824,7 @@ msgstr "Handy-Applikation"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentation"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Dashboard Administration"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -811,7 +811,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
|
|
|
@ -821,7 +821,7 @@ msgstr "Poŝaparata programo"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentaro"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Administra panelo"
|
||||
|
||||
#, fuzzy
|
||||
|
|
|
@ -818,7 +818,7 @@ msgstr "Aplicación móvil"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentación"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Panel de administración"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -815,7 +815,7 @@ msgstr "Aplicación móvil"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentación"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Panel de administración"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -782,7 +782,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -824,7 +824,7 @@ msgstr "Application mobile"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentation"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Panneau d'administration"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -788,7 +788,7 @@ msgstr "יישום לנייד"
|
|||
msgid "Documentation"
|
||||
msgstr "דוקומנטציה"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -829,7 +829,7 @@ msgstr "मोबाइल एप्लीकेशन"
|
|||
msgid "Documentation"
|
||||
msgstr "प्रलेखन"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "व्यवस्थापन डैशबोर्ड"
|
||||
|
||||
#, fuzzy
|
||||
|
|
|
@ -817,7 +817,7 @@ msgstr "Mobil alkalmazás"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentáció"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Adminisztrátori vezérlőpult"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -812,7 +812,7 @@ msgstr "Aplikasi Gawai"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentasi"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Dasbor Administrasi"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -817,7 +817,7 @@ msgstr "Applicazione mobile"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentazione"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Cruscotto Amministrazione"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -797,7 +797,7 @@ msgstr "携帯アプリ"
|
|||
msgid "Documentation"
|
||||
msgstr "書類"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "管理ダッシュボード"
|
||||
|
||||
#, fuzzy
|
||||
|
|
|
@ -793,7 +793,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -793,7 +793,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -855,7 +855,7 @@ msgstr "Mobilprogram"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentasjon"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Administrasjonsoversiktspanel"
|
||||
|
||||
#, fuzzy
|
||||
|
|
|
@ -814,7 +814,7 @@ msgstr "Mobiele app"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentatie"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Administratie-overzicht"
|
||||
|
||||
#, fuzzy
|
||||
|
|
|
@ -777,7 +777,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr "Documentacion"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Panèl d’administracion"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -812,7 +812,7 @@ msgstr "Aplikacja mobilna"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentacja"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Kokpit administracyjny"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -823,7 +823,7 @@ msgstr "Aplicação Mobile"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentação"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Painel de Administração"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -809,7 +809,7 @@ msgstr "Aplicativo"
|
|||
msgid "Documentation"
|
||||
msgstr "Documentação"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Painel de Administração"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -816,7 +816,7 @@ msgstr "Мобильное приложение"
|
|||
msgid "Documentation"
|
||||
msgstr "Документация"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Панель инструментов администратора"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -783,7 +783,7 @@ msgstr "Mobilna Aplikacija"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentacija"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -818,7 +818,7 @@ msgstr "Mobilapplikation"
|
|||
msgid "Documentation"
|
||||
msgstr "Dokumentation"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Översiktspanel för administration"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -809,7 +809,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -817,7 +817,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -778,7 +778,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -811,7 +811,7 @@ msgstr "Telefon Uygulaması"
|
|||
msgid "Documentation"
|
||||
msgstr "Belgelendirme"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "Yönetici Gösterge Paneli"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -791,7 +791,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -776,7 +776,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -775,7 +775,7 @@ msgstr ""
|
|||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr ""
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
|
@ -779,7 +779,7 @@ msgstr "手机软件"
|
|||
msgid "Documentation"
|
||||
msgstr "文件"
|
||||
|
||||
msgid "Administation Dashboard"
|
||||
msgid "Administration Dashboard"
|
||||
msgstr "管理面板"
|
||||
|
||||
msgid "Legal information"
|
||||
|
|
Loading…
Reference in a new issue