Merge branch '4_table-sorting'

This commit is contained in:
2025-06-01 17:18:54 +03:00

View File

@@ -108,16 +108,30 @@ function getCellValue(userstory: Userstory, header: TableHeader): string | numbe
if (header.key === "status") { if (header.key === "status") {
return userstory.status_extra_info?.name || userstory.status.toString(); return userstory.status_extra_info?.name || userstory.status.toString();
} }
return userstory[header.key as keyof Userstory] ?? ""; const value = userstory[header.key as keyof Userstory];
if (value === null) return null;
if (typeof value === "string" || typeof value === "number") return value;
if (value === undefined) return "";
return String(value);
} else { } else {
if (header.attributeId === undefined) return "N/A (no attr ID)"; if (header.attributeId === undefined) return "N/A (no attr ID)";
const attributes = dataStore.userstoryAttributesMap.get(userstory.id); const attributes = dataStore.userstoryAttributesMap.get(userstory.id);
if (attributes) { if (attributes) {
// Ключи для кастомных полей приходят как строки // Ключи для кастомных полей приходят как строки
return attributes[header.attributeId.toString()] ?? ""; const attrValue = attributes[header.attributeId.toString()];
if (attrValue === null) return null;
if (typeof attrValue === "string" || typeof attrValue === "number") return attrValue;
if (attrValue === undefined) return "";
return String(attrValue);
} }
return isLoadingAttributesForAnyStory.value ? "..." : "";
if (isLoadingAttributesForAnyStory.value && !dataStore.userstoryAttributesMap.has(userstory.id)) {
return "...";
}
return "";
} }
} }
</script> </script>