From 4223018177e5e9816ae54f5ba84bd73041cfb23e Mon Sep 17 00:00:00 2001 From: mateszddd <123839696+mateszddd@users.noreply.github.com> Date: Tue, 10 Oct 2023 09:03:54 +0200 Subject: [PATCH] added assigned to in tasks (#126) --- grocy-chores-card.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/grocy-chores-card.js b/grocy-chores-card.js index 6377fef..1aa73d7 100644 --- a/grocy-chores-card.js +++ b/grocy-chores-card.js @@ -302,14 +302,14 @@ class GrocyChoresCard extends LitElement { } _shouldRenderAssignedToUser(item) { - return this.show_assigned && item.next_execution_assigned_user != null; + return this.show_assigned && item.assigned_to_name != null; } _renderAssignedToUser(item) { return html`
${this._translate("Assigned to")}: - ${item.next_execution_assigned_user.display_name} + ${item.assigned_to_name}
` } @@ -597,7 +597,12 @@ class GrocyChoresCard extends LitElement { const tasks = []; items.map(item => { item.__type = "task"; - item.__user_id = item.assigned_to_user_id; + + if (item.assigned_to_user) { + item.__user_id = item.assigned_to_user.id; + item.assigned_to_name = item.assigned_to_user.display_name; + } + if (item.due_date != null) { item.__due_date = this._toDateTime(item.due_date); item.__due_in_days = this._calculateDaysTillNow(item.__due_date); @@ -629,6 +634,7 @@ class GrocyChoresCard extends LitElement { item.__type = "chore"; if (item.next_execution_assigned_user) { item.__user_id = item.next_execution_assigned_user.id; + item.assigned_to_name = item.next_execution_assigned_user.display_name; } if (item.next_estimated_execution_time != null && item.next_estimated_execution_time.slice(0, 4) !== 2999) {