Compare commits

...

8 commits

Author SHA1 Message Date
Sylvieox
4d1f47c253
Merge dce7bd7815 into cf77b4c346 2024-11-16 11:55:10 +01:00
MediMilk
cf77b4c346
Corrected typo Administation > Administration (#1332)
Some checks failed
Check doc / test_doc (push) Has been cancelled
Docker build / test (push) Has been cancelled
Lint & unit tests / lint (push) Has been cancelled
Docker build / build_upload (push) Has been cancelled
Lint & unit tests / test (mariadb, minimal, 3.11) (push) Has been cancelled
Lint & unit tests / test (mariadb, normal, 3.11) (push) Has been cancelled
Lint & unit tests / test (mariadb, normal, 3.9) (push) Has been cancelled
Lint & unit tests / test (postgresql, minimal, 3.11) (push) Has been cancelled
Lint & unit tests / test (postgresql, normal, 3.11) (push) Has been cancelled
Lint & unit tests / test (postgresql, normal, 3.9) (push) Has been cancelled
Lint & unit tests / test (sqlite, minimal, 3.10) (push) Has been cancelled
Lint & unit tests / test (sqlite, minimal, 3.11) (push) Has been cancelled
Lint & unit tests / test (sqlite, minimal, 3.12) (push) Has been cancelled
Lint & unit tests / test (sqlite, minimal, 3.7) (push) Has been cancelled
Lint & unit tests / test (sqlite, minimal, 3.9) (push) Has been cancelled
Lint & unit tests / test (sqlite, normal, 3.10) (push) Has been cancelled
Lint & unit tests / test (sqlite, normal, 3.11) (push) Has been cancelled
Lint & unit tests / test (sqlite, normal, 3.12) (push) Has been cancelled
Lint & unit tests / test (sqlite, normal, 3.7) (push) Has been cancelled
Lint & unit tests / test (sqlite, normal, 3.8) (push) Has been cancelled
Lint & unit tests / test (sqlite, normal, 3.9) (push) Has been cancelled
Co-authored-by: MediMilk <chadricksoup@gmail.com>
2024-11-16 11:55:04 +01:00
Sylvieox
dce7bd7815 Have filter by date running properly 2024-05-07 10:34:58 -04:00
Sylvieox
417e144455 Have filter by date running properly 2024-05-07 05:59:54 -04:00
Sylvieox
5578e9ddad in models.py I used the has method and added id= so it can function properly 2024-05-07 04:31:04 -04:00
Sylvieox
5e710fb7f9 Adding filter option for the bills 2024-05-07 04:22:52 -04:00
RepoReader5
996e68c7c0
Merge pull request #1 from Sylvieox/Joseph
Wrote comments briefly explaining about "project_history" and "ip_rec…
2024-05-06 15:37:22 -04:00
RepoReader5
aac7d92f7b Wrote comments briefly explaining about "project_history" and "ip_recording". 2024-05-06 15:30:04 -04:00
48 changed files with 137 additions and 54 deletions

View file

@ -33,7 +33,7 @@ services:
- SECRET_KEY=tralala - SECRET_KEY=tralala
- SESSION_COOKIE_SECURE=True - SESSION_COOKIE_SECURE=True
- SHOW_ADMIN_EMAIL=True - SHOW_ADMIN_EMAIL=True
- SQLALCHEMY_DATABASE_URI=sqlite:////database/ihatemoney.db - SQLALCHEMY_DATABASE_URI=sqlite:///database/ihatemoney.db
- SQLALCHEMY_TRACK_MODIFICATIONS=False - SQLALCHEMY_TRACK_MODIFICATIONS=False
- APPLICATION_ROOT=/ - APPLICATION_ROOT=/
- ENABLE_CAPTCHA=False - ENABLE_CAPTCHA=False

View file

@ -1,5 +1,4 @@
import sys import sys
from hatchling.builders.hooks.plugin.interface import BuildHookInterface from hatchling.builders.hooks.plugin.interface import BuildHookInterface

BIN
ihatemoney.db Normal file

Binary file not shown.

View file

@ -8,7 +8,7 @@ DEBUG = False
# The database URI, reprensenting the type of database and how to connect to it. # The database URI, reprensenting the type of database and how to connect to it.
# Enter an absolute path here. # Enter an absolute path here.
SQLALCHEMY_DATABASE_URI = 'sqlite:////var/lib/ihatemoney/ihatemoney.sqlite' SQLALCHEMY_DATABASE_URI = 'sqlite:///var/lib/ihatemoney/ihatemoney.sqlite'
SQLACHEMY_ECHO = DEBUG SQLACHEMY_ECHO = DEBUG
# Will likely become the default value in flask-sqlalchemy >=3 ; could be removed # Will likely become the default value in flask-sqlalchemy >=3 ; could be removed

View file

@ -1,6 +1,6 @@
# Verbose and documented settings are in conf-templates/ihatemoney.cfg.j2 # Verbose and documented settings are in conf-templates/ihatemoney.cfg.j2
DEBUG = SQLACHEMY_ECHO = False DEBUG = SQLACHEMY_ECHO = False
SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/ihatemoney.db" SQLALCHEMY_DATABASE_URI = "sqlite:///C:/Users/sylvie c/Documents/GitHub/ihatemoney/ihatemoney.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = "tralala" SECRET_KEY = "tralala"
MAIL_DEFAULT_SENDER = "Budget manager <admin@example.com>" MAIL_DEFAULT_SENDER = "Budget manager <admin@example.com>"

View file

@ -136,8 +136,15 @@ class EditProjectForm(FlaskForm):
description=_("Enter a new code if you want to change it"), description=_("Enter a new code if you want to change it"),
) )
contact_email = StringField(_("Email"), validators=[DataRequired(), Email()]) contact_email = StringField(_("Email"), validators=[DataRequired(), Email()])
# Create a checkbox in project settings to enable project history (keeps track of project transactions,
# like adding/settling bills). "Y/N" determines if transaction history is being recorded for the project.
project_history = BooleanField(_("Enable project history")) project_history = BooleanField(_("Enable project history"))
# Create a checkbox in project settings to allow for recording source IP address from a given transaction listed
# in project history. "Y/N" determines if an IP address will be attached to a created entry in project history.
ip_recording = BooleanField(_("Use IP tracking for project history")) ip_recording = BooleanField(_("Use IP tracking for project history"))
currency_helper = CurrencyConverter() currency_helper = CurrencyConverter()
default_currency = SelectField( default_currency = SelectField(
_("Default Currency"), _("Default Currency"),

View file

@ -759,7 +759,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -264,6 +264,14 @@ class Project(db.Model):
.order_by(Bill.id.desc()) .order_by(Bill.id.desc())
) )
@staticmethod
def filter_by_date(query, start, end):
if start and end:
return query.filter(Bill.date.between(start, end))
else:
return query
def get_bill_weights(self): def get_bill_weights(self):
""" """
Return all bills for this project, along with the sum of weight for each bill. Return all bills for this project, along with the sum of weight for each bill.
@ -285,6 +293,11 @@ class Project(db.Model):
"""Ordered version of get_bill_weights""" """Ordered version of get_bill_weights"""
return self.order_bills(self.get_bill_weights()) return self.order_bills(self.get_bill_weights())
def get_filtered_date_bill_weights_ordered(self, start, end):
bill_weights_ordered = self.get_bill_weights_ordered()
filtered_bill_weights = self.filter_by_date(bill_weights_ordered, start,end )
return filtered_bill_weights
def get_member_bills(self, member_id): def get_member_bills(self, member_id):
"""Return the list of bills related to a specific member""" """Return the list of bills related to a specific member"""
return ( return (

View file

@ -168,7 +168,7 @@
<i class="icon book">{{ static_include("images/book.svg") | safe }}</i> <i class="icon book">{{ static_include("images/book.svg") | safe }}</i>
</a> </a>
{% if g.show_admin_dashboard_link %} {% 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> <i class="icon admin">{{ static_include("images/cog.svg") | safe }}</i>
</a> </a>
{% endif %} {% endif %}

View file

@ -105,6 +105,15 @@
<li class="page-item {% if bills.page == bills.pages %}disabled{% endif %}"><a class="page-link" href="{{ url_for('main.list_bills', page=bills.next_num) }}">{{ _("Older bills") }} &raquo;</a></li> <li class="page-item {% if bills.page == bills.pages %}disabled{% endif %}"><a class="page-link" href="{{ url_for('main.list_bills', page=bills.next_num) }}">{{ _("Older bills") }} &raquo;</a></li>
</ul> </ul>
{% endif %} {% endif %}
<form action="{{ url_for(".list_bills") }}" method="post">
{{ csrf_form.csrf_token }}
<label for="start">Start Date:</label>
<input type="date" id="start" name="start" value="{{ start if start else '' }}">
<label for="end">End Date:</label>
<input type="date" id="end" name="end" value="{{ end if end else '' }}">
<input type="submit" value="Enter">
</form>
<span id="new-bill" class="ml-auto pb-2" {% if not g.project.members %} data-toggle="tooltip" title="{{_('You should start by adding participants')}}" {% endif %}> <span id="new-bill" class="ml-auto pb-2" {% if not g.project.members %} data-toggle="tooltip" title="{{_('You should start by adding participants')}}" {% endif %}>
<a href="{{ url_for('.add_bill') }}" class="btn btn-primary {% if not g.project.members %} disabled {% endif %}" data-toggle="modal" data-keyboard="true" data-target="#bill-form" autofocus> <a href="{{ url_for('.add_bill') }}" class="btn btn-primary {% if not g.project.members %} disabled {% endif %}" data-toggle="modal" data-keyboard="true" data-target="#bill-form" autofocus>
<i class="icon icon-white before-text">{{ static_include("images/plus.svg") | safe }}</i> <i class="icon icon-white before-text">{{ static_include("images/plus.svg") | safe }}</i>

View file

@ -0,0 +1,41 @@
import pytest
from unittest.mock import Mock
from ihatemoney.models import Project, Bill
@pytest.fixture
def test_filter_by_date(Project):
# Prepare mock data
mock_query = Mock()
start_date = '2024-01-01'
end_date = '2024-12-31'
# Mock the methods being called inside filter_by_date
Project.query.filter.return_value = Mock() # Assuming you're using SQLAlchemy's Query object
# Call the method to test
result = Project.filter_by_date(mock_query, start_date, end_date)
# Assertions
assert result == Project.query.filter.return_value # Check if the method returns the expected result
Project.query.filter.assert_called_once_with(Bill.date >= start_date,
Bill.date <= end_date) # Check if filter was called with the correct arguments
def test_get_filtered_date_bill_weights_ordered(Project):
# Prepare mock data
start_date = '2024-01-01'
end_date = '2024-12-31'
Project.get_bill_weights_ordered.return_value = Mock()
Project.filter_by_date.return_value = Mock()
# Call the method to test
result = Project.get_filtered_date_bill_weights_ordered(start_date, end_date)
# Assertions
assert result == Project.filter_by_date.return_value # Check if the method returns the expected result
Project.filter_by_date.assert_called_once_with(
Project.get_bill_weights_ordered.return_value, start_date,
end_date) # Check if filter_by_date was called with the correct arguments

View file

@ -782,7 +782,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -785,7 +785,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -826,7 +826,7 @@ msgstr "Aplicació mòbil"
msgid "Documentation" msgid "Documentation"
msgstr "Documentació" msgstr "Documentació"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Panell d'administració" msgstr "Panell d'administració"
msgid "Legal information" msgid "Legal information"

View file

@ -800,7 +800,7 @@ msgstr "Mobilní aplikace"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentace" msgstr "Dokumentace"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Správcovský panel" msgstr "Správcovský panel"
msgid "Legal information" msgid "Legal information"

View file

@ -824,7 +824,7 @@ msgstr "Handy-Applikation"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentation" msgstr "Dokumentation"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Dashboard Administration" msgstr "Dashboard Administration"
msgid "Legal information" msgid "Legal information"

View file

@ -811,7 +811,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
#, fuzzy #, fuzzy

View file

@ -821,7 +821,7 @@ msgstr "Poŝaparata programo"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentaro" msgstr "Dokumentaro"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Administra panelo" msgstr "Administra panelo"
#, fuzzy #, fuzzy

View file

@ -818,7 +818,7 @@ msgstr "Aplicación móvil"
msgid "Documentation" msgid "Documentation"
msgstr "Documentación" msgstr "Documentación"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Panel de administración" msgstr "Panel de administración"
msgid "Legal information" msgid "Legal information"

View file

@ -815,7 +815,7 @@ msgstr "Aplicación móvil"
msgid "Documentation" msgid "Documentation"
msgstr "Documentación" msgstr "Documentación"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Panel de administración" msgstr "Panel de administración"
msgid "Legal information" msgid "Legal information"

View file

@ -782,7 +782,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -824,7 +824,7 @@ msgstr "Application mobile"
msgid "Documentation" msgid "Documentation"
msgstr "Documentation" msgstr "Documentation"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Panneau d'administration" msgstr "Panneau d'administration"
msgid "Legal information" msgid "Legal information"

View file

@ -788,7 +788,7 @@ msgstr "יישום לנייד"
msgid "Documentation" msgid "Documentation"
msgstr "דוקומנטציה" msgstr "דוקומנטציה"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -829,7 +829,7 @@ msgstr "मोबाइल एप्लीकेशन"
msgid "Documentation" msgid "Documentation"
msgstr "प्रलेखन" msgstr "प्रलेखन"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "व्यवस्थापन डैशबोर्ड" msgstr "व्यवस्थापन डैशबोर्ड"
#, fuzzy #, fuzzy

View file

@ -817,7 +817,7 @@ msgstr "Mobil alkalmazás"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentáció" msgstr "Dokumentáció"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Adminisztrátori vezérlőpult" msgstr "Adminisztrátori vezérlőpult"
msgid "Legal information" msgid "Legal information"

View file

@ -812,7 +812,7 @@ msgstr "Aplikasi Gawai"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentasi" msgstr "Dokumentasi"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Dasbor Administrasi" msgstr "Dasbor Administrasi"
msgid "Legal information" msgid "Legal information"

View file

@ -817,7 +817,7 @@ msgstr "Applicazione mobile"
msgid "Documentation" msgid "Documentation"
msgstr "Documentazione" msgstr "Documentazione"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Cruscotto Amministrazione" msgstr "Cruscotto Amministrazione"
msgid "Legal information" msgid "Legal information"

View file

@ -797,7 +797,7 @@ msgstr "携帯アプリ"
msgid "Documentation" msgid "Documentation"
msgstr "書類" msgstr "書類"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "管理ダッシュボード" msgstr "管理ダッシュボード"
#, fuzzy #, fuzzy

View file

@ -793,7 +793,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -793,7 +793,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -855,7 +855,7 @@ msgstr "Mobilprogram"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentasjon" msgstr "Dokumentasjon"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Administrasjonsoversiktspanel" msgstr "Administrasjonsoversiktspanel"
#, fuzzy #, fuzzy

View file

@ -814,7 +814,7 @@ msgstr "Mobiele app"
msgid "Documentation" msgid "Documentation"
msgstr "Documentatie" msgstr "Documentatie"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Administratie-overzicht" msgstr "Administratie-overzicht"
#, fuzzy #, fuzzy

View file

@ -777,7 +777,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "Documentacion" msgstr "Documentacion"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Panèl dadministracion" msgstr "Panèl dadministracion"
msgid "Legal information" msgid "Legal information"

View file

@ -812,7 +812,7 @@ msgstr "Aplikacja mobilna"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentacja" msgstr "Dokumentacja"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Kokpit administracyjny" msgstr "Kokpit administracyjny"
msgid "Legal information" msgid "Legal information"

View file

@ -823,7 +823,7 @@ msgstr "Aplicação Mobile"
msgid "Documentation" msgid "Documentation"
msgstr "Documentação" msgstr "Documentação"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Painel de Administração" msgstr "Painel de Administração"
msgid "Legal information" msgid "Legal information"

View file

@ -809,7 +809,7 @@ msgstr "Aplicativo"
msgid "Documentation" msgid "Documentation"
msgstr "Documentação" msgstr "Documentação"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Painel de Administração" msgstr "Painel de Administração"
msgid "Legal information" msgid "Legal information"

View file

@ -816,7 +816,7 @@ msgstr "Мобильное приложение"
msgid "Documentation" msgid "Documentation"
msgstr "Документация" msgstr "Документация"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Панель инструментов администратора" msgstr "Панель инструментов администратора"
msgid "Legal information" msgid "Legal information"

View file

@ -783,7 +783,7 @@ msgstr "Mobilna Aplikacija"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentacija" msgstr "Dokumentacija"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -818,7 +818,7 @@ msgstr "Mobilapplikation"
msgid "Documentation" msgid "Documentation"
msgstr "Dokumentation" msgstr "Dokumentation"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Översiktspanel för administration" msgstr "Översiktspanel för administration"
msgid "Legal information" msgid "Legal information"

View file

@ -809,7 +809,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -817,7 +817,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -778,7 +778,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -811,7 +811,7 @@ msgstr "Telefon Uygulaması"
msgid "Documentation" msgid "Documentation"
msgstr "Belgelendirme" msgstr "Belgelendirme"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "Yönetici Gösterge Paneli" msgstr "Yönetici Gösterge Paneli"
msgid "Legal information" msgid "Legal information"

View file

@ -791,7 +791,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -776,7 +776,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -775,7 +775,7 @@ msgstr ""
msgid "Documentation" msgid "Documentation"
msgstr "" msgstr ""
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "" msgstr ""
msgid "Legal information" msgid "Legal information"

View file

@ -779,7 +779,7 @@ msgstr "手机软件"
msgid "Documentation" msgid "Documentation"
msgstr "文件" msgstr "文件"
msgid "Administation Dashboard" msgid "Administration Dashboard"
msgstr "管理面板" msgstr "管理面板"
msgid "Legal information" msgid "Legal information"

View file

@ -642,7 +642,7 @@ def invite():
return render_template("send_invites.html", form=form, qrcode=qrcode_svg) return render_template("send_invites.html", form=form, qrcode=qrcode_svg)
@main.route("/<project_id>/") @main.route("/<project_id>/", methods=["GET", "POST"])
def list_bills(): def list_bills():
bill_form = get_billform_for(g.project) bill_form = get_billform_for(g.project)
# Used for CSRF validation # Used for CSRF validation
@ -666,10 +666,23 @@ def list_bills():
# Each item will be a (weight_sum, Bill) tuple. # Each item will be a (weight_sum, Bill) tuple.
# TODO: improve this awkward result using column_property: # TODO: improve this awkward result using column_property:
# https://docs.sqlalchemy.org/en/14/orm/mapped_sql_expr.html. # https://docs.sqlalchemy.org/en/14/orm/mapped_sql_expr.html.
if request.method == "GET":
# Retrieve ordered bill weights for the project
weighted_bills = g.project.get_bill_weights_ordered().paginate( weighted_bills = g.project.get_bill_weights_ordered().paginate(
per_page=100, error_out=True per_page=100, error_out=True
) )
elif request.method == "POST":
# Retrieve start_date and end_date from form data
start = request.form.get('start')
end = request.form.get('end')
# Retrieve filtered bill weights by date
weighted_bills = g.project.get_filtered_date_bill_weights_ordered(start, end).paginate(
per_page=100, error_out=True
)
# Render the template with the appropriate data
return render_template( return render_template(
"list_bills.html", "list_bills.html",
bills=weighted_bills, bills=weighted_bills,
@ -678,9 +691,10 @@ def list_bills():
csrf_form=csrf_form, csrf_form=csrf_form,
add_bill=request.values.get("add_bill", False), add_bill=request.values.get("add_bill", False),
current_view="list_bills", current_view="list_bills",
start=start if request.method == "POST" else None,
end=end if request.method == "POST" else None,
) )
@main.route("/<project_id>/members/add", methods=["GET", "POST"]) @main.route("/<project_id>/members/add", methods=["GET", "POST"])
def add_member(): def add_member():
# FIXME manage form errors on the list_bills page # FIXME manage form errors on the list_bills page