Support #18814
closedtask board "my tasks" doesn't filter out stories assigned to me just because they don't have any tasks
100%
Description
When choosing "my tasks" on the task board, it should show
a) stories (and all their subtasks) which are assigned to me
b) stories (and all their subtasks) which have a least one subtask that is assigned to me
and filter out everything else.
Updated by Ward Vandewege almost 3 years ago
- Status changed from New to In Progress
Ready for testing at https://dev-dev.arvados.org/rb/taskboards/344
The current diff is
--- ../../../dev.arvados.org/plugins/redmine_backlogs/assets/javascripts/taskboard.js 2017-10-14 02:00:38.000000000 +0000 +++ ../../public/plugin_assets/redmine_backlogs/javascripts/taskboard.js 2022-03-02 21:07:11.705538077 +0000 @@ -249,7 +249,19 @@ try{ task_ownerid = RB.$(".assigned_to_id .v", this).text(); } catch(e){ return; } - if (!task_ownerid || me.el.multiselect("widget").find(":checkbox[value='"+task_ownerid+"']").is(':checked')) { + + try{ + story_id = RB.$(".meta .story_id", this).text(); + story_ownerid = RB.$("#story_"+story_id+" .meta .assigned_to_id").text() + isVisStory = ((story_ownerid == "") || me.el.multiselect("widget").find(":checkbox[value='"+story_ownerid+"']").is(':checked')); + } catch(e){ return; } + + // show tasks if: + // * they are unassigned + // * they are assigned to a user that should be shown + // * they are on a story that is unassigned + // * they are on a story assigned to a user that should be shown + if (!task_ownerid || me.el.multiselect("widget").find(":checkbox[value='"+task_ownerid+"']").is(':checked') || isVisStory) { RB.$(this).show(); }else { RB.$(this).hide(); @@ -258,6 +270,7 @@ }, updateStories: function() { + var me = this; //Check if all stories should be visible even if not used var showUnusedStories = this.el.multiselect("widget").find(":checkbox[value='s']").is(':checked'); var showClosedStories = this.el.multiselect("widget").find(":checkbox[value='c']").is(':checked'); @@ -266,6 +279,8 @@ RB.$('.story').each(function() { var sprintInfo = RB.$(this).children('.id').children('a')[0]; var storyID = sprintInfo.innerHTML; + story_ownerid = RB.$(".meta .assigned_to_id", this).text(); + isVisStory = ((story_ownerid == "") || me.el.multiselect("widget").find(":checkbox[value='"+story_ownerid+"']").is(':checked')); var isClosed = RB.$(this).hasClass('closed'); @@ -282,8 +297,12 @@ }); }); - //Hide or show story row based on if any tasks are visible - if ((hasVisTasks || (showUnusedStories && !hasTasks)) && (showClosedStories || !isClosed)) + // Hide or show story row (subject to showUnusedStories and showClosedStories) if: + // * it has visible tasks + // * it is unassigned + // * it is assigned to a user that should be shown + if (((hasVisTasks || (showUnusedStories && !hasTasks)) && (showClosedStories || !isClosed)) || + ((isVisStory || (showUnusedStories && !hasTasks)) && (showClosedStories || !isClosed))) RB.$(this).closest('tr').show(); else RB.$(this).closest('tr').hide();
Updated by Peter Amstutz almost 3 years ago
This looks pretty good! let's give it a shot!
Updated by Ward Vandewege almost 3 years ago
Peter Amstutz wrote:
This looks pretty good! let's give it a shot!
Ready for another look at https://dev-dev.arvados.org/rb/taskboards/344
This adds a "Show unassigned" checkbox, and makes the logic more simple - all check boxes are now interpreted as if they have "OR" in between, and they apply to tasks and stories alike.
The current diff is:
diff --git a/app/views/rb_taskboards/show.html.erb b/app/views/rb_taskboards/show.html.erb index 6eda5739..13ecebb1 100644 --- a/app/views/rb_taskboards/show.html.erb +++ b/app/views/rb_taskboards/show.html.erb @@ -43,8 +43,9 @@ <ul style="list-style:none; margin:0px"> <li><label> <select class="userfilter" size="5" name="filter-user-selection" multiple="multiple" title="User selection"> - <option value='s'>Show empty Stories</option> - <option value='c'>Show closed Stories</option> + <option value='s'>Show empty</option> + <option value='c'>Show closed</option> + <option value='u'>Show unassigned</option> <optgroup label="Users"> <% @project.assignable_users.sort.each do |member| %> <option value="<%= member.id %>"> <%= member.name %></option> diff --git a/assets/javascripts/taskboard.js b/assets/javascripts/taskboard.js index 548be2bc..284189f6 100644 --- a/assets/javascripts/taskboard.js +++ b/assets/javascripts/taskboard.js @@ -234,6 +234,9 @@ RB.UserFilter = RB.Object.create({ onUnCheckAll: function() { var uid = RB.$("#userid").text(); this.el.multiselect("widget").find(":checkbox[value='"+uid+"']").each(function() {this.checked = true;} ); + // Keep "show unassigned" checked by default, because we want every team member to be aware + // of those stories/tasks: they are a joint team responsibility. + this.el.multiselect("widget").find(":checkbox[value='u']").each(function() {this.checked = true;} ); this.updateUI(); }, @@ -249,23 +252,52 @@ RB.UserFilter = RB.Object.create({ try{ task_ownerid = RB.$(".assigned_to_id .v", this).text(); } catch(e){ return; } - if (!task_ownerid || me.el.multiselect("widget").find(":checkbox[value='"+task_ownerid+"']").is(':checked')) { + + try{ + storyID = RB.$(".meta .story_id", this).text(); + story_ownerid = RB.$("#story_"+storyID+" .meta .assigned_to_id").text() + showUnassigned = me.el.multiselect("widget").find(":checkbox[value='u']").is(':checked'); + showClosed = me.el.multiselect("widget").find(":checkbox[value='c']").is(':checked'); + isUnassignedStory = (story_ownerid == ""); + isClosedStory = RB.$("#story_"+storyID).hasClass('closed'); + isVisStory = me.el.multiselect("widget").find(":checkbox[value='"+story_ownerid+"']").is(':checked'); + } catch(e){ return; } + + isClosed = RB.$(this).hasClass('closed'); + // show tasks if: + // * they are unassigned and "Show unassigned" is checked + // * OR they are closed and "Show closed" is checked + // * OR they are assigned to a user that should be shown + // * OR they are on a story that is unassigned and "Show unassigned" is checked + // * OR they are on a story that is closed and "Show closed" is checked + // * OR they are on a story assigned to a user that should be shown + if ((!task_ownerid && showUnassigned) || + (isClosed && showClosed) || + (task_ownerid && me.el.multiselect("widget").find(":checkbox[value='"+task_ownerid+"']").is(':checked')) || + (isUnassignedStory && showUnassigned) || + (isClosedStory && showClosed) || + isVisStory) { RB.$(this).show(); - }else { + } else { RB.$(this).hide(); } }); }, updateStories: function() { + var me = this; //Check if all stories should be visible even if not used var showUnusedStories = this.el.multiselect("widget").find(":checkbox[value='s']").is(':checked'); var showClosedStories = this.el.multiselect("widget").find(":checkbox[value='c']").is(':checked'); + var showUnassigned = this.el.multiselect("widget").find(":checkbox[value='u']").is(':checked'); //Parse through all the stories and hide the ones not used RB.$('.story').each(function() { var sprintInfo = RB.$(this).children('.id').children('a')[0]; var storyID = sprintInfo.innerHTML; + story_ownerid = RB.$(".meta .assigned_to_id", this).text(); + isUnassigned = (story_ownerid == ""); + isVisStory = me.el.multiselect("widget").find(":checkbox[value='"+story_ownerid+"']").is(':checked'); var isClosed = RB.$(this).hasClass('closed'); @@ -282,8 +314,17 @@ RB.UserFilter = RB.Object.create({ }); }); - //Hide or show story row based on if any tasks are visible - if ((hasVisTasks || (showUnusedStories && !hasTasks)) && (showClosedStories || !isClosed)) + // Show story row if: + // * it is unassigned and "Show unassigned" is checked + // * OR it is empty and "Show empty" is checked + // * OR it is closed and "Show closed" is checked + // * OR it is assigned to a user that should be shown + // * OR it has visible tasks + if ((isUnassigned && showUnassigned) || + (showUnusedStories && !hasTasks) || + (showClosedStories && isClosed) || + isVisStory || + hasVisTasks) RB.$(this).closest('tr').show(); else RB.$(this).closest('tr').hide();
Updated by Peter Amstutz almost 3 years ago
I don't think the "implied OR" quite works, if I uncheck "Show closed" I still see closed stories. This is because "show all" and "show mine only" work by checking/unchecking whether I see stories belonging to other users. For a story that would be displayed, that is always "true" and so "OR show closed" cannot cause it to be hidden.
Updated by Peter Amstutz almost 3 years ago
From discussion:
- If "show closed" is unchecked, don't show anything that is closed
- To the "all users" and "my tasks" add "nobody" button which unchecks all users
Updated by Ward Vandewege almost 3 years ago
Peter Amstutz wrote:
From discussion:
- If "show closed" is unchecked, don't show anything that is closed
- To the "all users" and "my tasks" add "nobody" button which unchecks all users
Ready for another look at https://dev-dev.arvados.org/rb/taskboards/344
Updated by Peter Amstutz almost 3 years ago
Ward Vandewege wrote:
Peter Amstutz wrote:
From discussion:
- If "show closed" is unchecked, don't show anything that is closed
- To the "all users" and "my tasks" add "nobody" button which unchecks all users
Ready for another look at https://dev-dev.arvados.org/rb/taskboards/344
This looks good, I appreciate having the three distinct views.
Updated by Ward Vandewege almost 3 years ago
- Status changed from In Progress to Resolved