fix: hide daily quota without limit

This commit is contained in:
2026-06-09 16:23:13 +08:00
parent 98410b0fe0
commit 3b9d092c06
4 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "shusub2" name = "shusub2"
version = "0.1.4" version = "0.1.5"
description = "Terminal UI for Sub2API account quota and daily usage" description = "Terminal UI for Sub2API account quota and daily usage"
readme = "README.md" readme = "README.md"
requires-python = ">=3.11" requires-python = ">=3.11"
+1 -3
View File
@@ -297,10 +297,8 @@ def window_cell(account: dict[str, Any], window_id: str) -> str:
def daily_quota_cell(account: dict[str, Any]) -> str: def daily_quota_cell(account: dict[str, Any]) -> str:
limit = account.get("daily_quota_limit") limit = account.get("daily_quota_limit")
used = account.get("daily_quota_used") used = account.get("daily_quota_used")
if limit is None and used is None:
return "-"
if limit is None: if limit is None:
return str(used) return "-"
return f"{used or 0}/{limit}" return f"{used or 0}/{limit}"
+5
View File
@@ -121,6 +121,11 @@ class Sub2APIQuotaTUITests(unittest.TestCase):
self.assertEqual(rows[0]["daily_quota_cell"], "96.6/300") self.assertEqual(rows[0]["daily_quota_cell"], "96.6/300")
self.assertTrue(rows[0]["reset"].endswith("00:00") or rows[0]["reset"] != "-") 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: def test_monitor_availability_column_uses_bound_monitor_status(self) -> None:
mod = load_module() mod = load_module()
payload = { payload = {
Generated
+1 -1
View File
@@ -85,7 +85,7 @@ wheels = [
[[package]] [[package]]
name = "shusub2" name = "shusub2"
version = "0.1.4" version = "0.1.5"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "textual" }, { name = "textual" },