fix: hide daily quota without limit
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "shusub2"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
description = "Terminal UI for Sub2API account quota and daily usage"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
|
||||
@@ -297,10 +297,8 @@ def window_cell(account: dict[str, Any], window_id: str) -> str:
|
||||
def daily_quota_cell(account: dict[str, Any]) -> str:
|
||||
limit = account.get("daily_quota_limit")
|
||||
used = account.get("daily_quota_used")
|
||||
if limit is None and used is None:
|
||||
return "-"
|
||||
if limit is None:
|
||||
return str(used)
|
||||
return "-"
|
||||
return f"{used or 0}/{limit}"
|
||||
|
||||
|
||||
|
||||
@@ -121,6 +121,11 @@ class Sub2APIQuotaTUITests(unittest.TestCase):
|
||||
self.assertEqual(rows[0]["daily_quota_cell"], "96.6/300")
|
||||
self.assertTrue(rows[0]["reset"].endswith("00:00") or rows[0]["reset"] != "-")
|
||||
|
||||
def test_daily_quota_cell_is_dash_without_limit(self) -> None:
|
||||
mod = load_module()
|
||||
|
||||
self.assertEqual(mod.daily_quota_cell({"daily_quota_used": 0}), "-")
|
||||
|
||||
def test_monitor_availability_column_uses_bound_monitor_status(self) -> None:
|
||||
mod = load_module()
|
||||
payload = {
|
||||
|
||||
Reference in New Issue
Block a user