Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-3320 [FIX] Show days in TTL time display instead of only hours (#1847)

vishnuszipstack8a7db7c52f5e
diff --git a/backend/utils/user_utils.py b/backend/utils/user_utils.py
new file mode 100644
index 000000000..d74b214d6
--- /dev/null
+++ b/backend/utils/user_utils.py
@@ -0,0 +1,41 @@
+from collections.abc import Iterable
+
+from account_v2.models import User
+
+
+def batch_resolve_user_ids(user_ids: Iterable[str]) -> dict[str, dict[str, str]]:
+ """Batch resolve user IDs to display info in a single query.
+
+ Accepts stringified integer PKs (as stored in CharField fields like
+ HITLQueue.reviewer_id / approver_id) and returns a lookup dict
+ mapping each string PK to display info.
+
+ Args:
+ user_ids: Iterable of stringified user PKs to resolve.
+
+ Returns:
+ dict mapping each string PK to {'name': str, 'email': str}.
+ PKs that cannot be resolved (non-existent users or invalid IDs)
+ are omitted from the result; callers should use `.get()` for safe access.
+ """
+ pk_set = set()
+ for uid in user_ids or []:
+ try:
+ pk_set.add(int(uid))
+ except (ValueError, TypeError):
+ continue
+
+ if not pk_set:
+ return {}
+
+ lookup = {}
+ for user in User.objects.filter(pk__in=pk_set):
+ display_name = (
+ user.get_full_name()
+ or (user.email.split("@")[0] if user.email else None)
+ or user.username
+ )
+ info = {"name": display_name, "email": user.email or ""}
+ lookup[str(user.pk)] = info
+
+ return lookup
diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.js
index c9e309989..c8b520b6d 100644
--- a/frontend/src/helpers/GetStaticData.js
+++ b/frontend/src/helpers/GetStaticData.js
@@ -690,11 +690,15 @@ const formatTimeDisplay = (seconds) => {
return "Expired";
}
- const hours = Math.floor(seconds / 3600);
+ const days = Math.floor(seconds / 86400);
+ const hours = Math.floor((seconds % 86400) / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = Math.floor(seconds % 60);
const parts = [];
+ if (days > 0) {
+ parts.push(`${days}d`);
+ }
if (hours > 0) {
parts.push(`${hours}h`);
}