Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ email-validator~=2.3.0
fastapi~=0.136.3
fastapi-pagination==0.15.13 # pinned exactly: 0.15.16 breaks against fastapi 0.136.3 (TypeError: get_body_field() got an unexpected keyword argument 'body_params') — confirmed on unmodified main, unrelated to the web UI work in this commit
greentechhub-fastapi @ git+https://github.com/GreenMachine582/greentechhub-fastapi.git@v0.8.0
greentechhub-ui @ git+https://github.com/GreenMachine582/greentechhub-ui.git@v0.9.0
greentechhub-ui @ git+https://github.com/GreenMachine582/greentechhub-ui.git@v0.10.0
httpx~=0.28.1
jinja2~=3.1
mypy~=2.1.0
Expand Down
4 changes: 1 addition & 3 deletions src/pyfinbot/web/templates/_stock_table.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{% from "table.html" import gth_data_table %}
{% from "badge.html" import gth_badge %}
{% from "_table_refresh.html" import table_refresh %}
{% call(stock) gth_data_table(table, [
{"label": "Symbol", "sort_key": "symbol"},
{"label": "Market", "sort_key": "market"},
{"label": "Name", "sort_key": "name"},
"Status",
"",
], stocks, empty_message="No stocks match these filters.") %}
], stocks, empty_message="No stocks match these filters.", refresh_event="stocksChanged") %}
<tr>
<td class="fw-semibold">{{ stock.symbol }}</td>
<td>{{ stock.market }}</td>
Expand All @@ -25,4 +24,3 @@
</td>
</tr>
{% endcall %}
{% if not table.rows_only %}{{ table_refresh(table, "stocksChanged") }}{% endif %}
10 changes: 0 additions & 10 deletions src/pyfinbot/web/templates/_table_refresh.html

This file was deleted.

4 changes: 1 addition & 3 deletions src/pyfinbot/web/templates/_transaction_table.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% from "table.html" import gth_data_table %}
{% from "badge.html" import gth_badge %}
{% from "_table_refresh.html" import table_refresh %}
{% call(txn) gth_data_table(table, [
{"label": "Date", "sort_key": "transaction_date"},
"Stock",
Expand All @@ -13,7 +12,7 @@
"FY",
"Notes",
"",
], transactions, empty_message="No transactions match these filters.") %}
], transactions, empty_message="No transactions match these filters.", refresh_event="transactionsChanged") %}
<tr>
<td class="text-nowrap">{{ txn.transaction_date.strftime("%d/%m/%Y") }}</td>
<td class="text-nowrap" title="{{ txn.stock.name }}">
Expand All @@ -39,4 +38,3 @@
</td>
</tr>
{% endcall %}
{% if not table.rows_only %}{{ table_refresh(table, "transactionsChanged") }}{% endif %}
4 changes: 3 additions & 1 deletion tests/test_web_stocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ async def test_filters(self, client):
resp = await client.get("/stocks", headers=HX, params={"status": "all", "sort": "symbol", "dir": "desc"})
assert resp.text.index("OLD") < resp.text.index("BHP")
assert 'id="stocks"' in resp.text and "<html" not in resp.text # the table fragment only
assert 'hx-get="/stocks?status=all&amp;sort=symbol&amp;dir=desc"' in resp.text # refresh keeps sort
# gth_data_table's refresh hook re-requests with the current sort + filters
assert ('class="gth-table-refresh" hx-get="/stocks?status=all&amp;sort=symbol&amp;dir=desc"'
' hx-trigger="stocksChanged from:body"') in resp.text

async def test_empty_state(self, client):
await web_login(client, "web-stocks")
Expand Down
1 change: 1 addition & 0 deletions tests/test_web_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ async def test_rows_show_resolved_stock_and_only_own_transactions(self, client):
assert "not yours" not in resp.text
assert "2024–25" in resp.text # FY 2024 = 1 Jul 2024 – 30 Jun 2025
assert 'aria-sort="descending"' in resp.text # newest first by default
assert 'hx-trigger="transactionsChanged from:body"' in resp.text # refreshed after saves
assert "gth-badge" in resp.text and "Buy</span>" in resp.text

async def test_filters(self, client):
Expand Down
Loading