ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Apply Filter does not work on all-project-activities view (Bug #861)


Added by E M at 2012-02-05 01:34 am. Updated at 2012-03-28 06:33 pm.


Status:Closed Start date:2012-02-05
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Journals / History
Target version:3.1.0
Remote issue URL: Affected version:2.6.0

Description

Reproduce
  1. http://demo.chiliproject.org/activity?
  2. deactivate "issues"
  3. click apply

issue:
you should now still see issues - all filters are reset

Think thats rather critical, as you cannot view "the lastes commits" this way.

Versions
  1. 2.6.0 is not working either
  2. 3.0.0 ( current demo ) is not working

Associated revisions

Revision 6f064d38
Added by Felix Schäfer at 2012-03-28 08:31 pm

Activity: use default filter only on first request #861

History

Updated by E M at 2012-02-05 01:43 am

well, actually a second later, i cannot reproduce it on 3.0.0 anymore - still broken in 2.6.0 - but as its fixed, iam just closing this

  • Target version deleted (3.0.0)
  • Status changed from Open to Declined

Updated by Holger Just at 2012-02-05 09:26 am

I can't reproduce it on neither demo.chiliproject.org, nor a 2.6.0 instance nor chiliproject.org. It all works as expected.

The activities filter works so that you only see the activity types you select there. What might be surprising is that the labels are actually links so that you can easily select a single activity type.

Updated by E M at 2012-02-06 10:44 pm

well for 2.6.0, its tricky:
- it will work for the global actiivities, but not for acitivities for projects with subprojects

Updated by E M at 2012-02-07 07:56 am

reopening, as actually the bug really exists: (current 3.0.0, bundle install with RVM )
( https://skitch.com/mayerxored/g9j95/chiliproject-bug )
- /projects/<yourparentprojectwithsubprojectsandcommits>/activity
- you see the filters on the right side
- deselect "issues" and leave include subproject checked
- click apply

Now, you still see issues being active.

What looks fishy to me is, that when i deslect issues and submit, i get this parameters projects/dw/activity?with_subprojects=0&with_subprojects=1 ... obvoisly wrong.

What plugins do i have?
- redmine_git_hosting .. but i doubt this influences this

Currently, d.c.o is 2.x, isnt it? ( could test on a different platform yet ). But there is an issue, i even could reproduce it on d.c.o, maybe the circumumstances are more complicated. More details would be:
- i just logged in
- pressed on projects and then the parent project in the upper right
- then started to use the filters

  • Target version set to 3.1.0
  • Status changed from Declined to Open

Updated by E M at 2012-02-07 07:57 am

(someone should lower the priority to normal or less :) )

Updated by Michaël Rigart at 2012-02-25 07:54 pm

Actually, the "wrong" parameter you call with_subprojects is correct :) . The state of the with_subprojects is defined by the checkbox and a hidden field (0 value).

The problem that you encounter has to do with the facts that your activity score parameter hash is empty, thus selecting al available event types again. Could you like try and select the "wiki edits" and deselect your "issues" . You'll see that it will hide all the issues.

Updated by Michaël Rigart at 2012-02-25 08:09 pm

Located the problem, but I'll like to talk about it with one of the core developers.

The issue is situated in the activities_controller line 36:

@activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?

Here you say that the activie scope has to be filled with default checkboxes or all (depending on user) if the scope is empty. So this means, if you uncheck all the event types, it will automatically fill it again with some default values.

So in the case of E M, who has 3 event types: issues, wiki edit and spent time. wiki edit and spint time are by default deselected. When he unchecks issues ( then you would think no activities would be displayed) his event activities has is empty so the system falls back on the defaults, hence showing the issues again.

Best way would be to check if the subproject param has been submitted or not to see if it as a user submission filter or the starting page request. I'll try to fix this and make a pull request

Updated by Michaël Rigart at 2012-02-25 08:26 pm

Ok, made a pull request: [[https://github.com/chiliproject/chiliproject/pull/159]]

Added an extra hidden field so Chiliproject can see that it has to display an empty result set instead of the default filter that is automatically requested on the initial page load.

Updated by Felix Schäfer at 2012-02-29 10:23 pm

Actually completely removing the line resetting the activity to default if no scope is defined is enough to ensure that when no box is selected no activity is shown, this has the effect to present the "empty" activity page when you navigate to it though.

The "correct" way to ensure that when no activity type is selected you get no activity would be to add a "0" hidden field before each checkbox, thus clearly stating the intention to have no activity when no checkbox is selected, the detection of the whether to show the "default" activity set when no parameter is passed would have to be changed though.

Michaël, do you think that's something you could try to do?

  • Priority changed from High to Normal

Updated by Holger Just at 2012-03-19 04:09 pm

An alternative variant could be to use a set_filter field, as we don now with issues.

 1diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
 2index cfc2be4..66b6fcc 100644
 3--- a/app/controllers/activities_controller.rb
 4+++ b/app/controllers/activities_controller.rb
 5@@ -33,7 +33,7 @@ class ActivitiesController < ApplicationController
 6                                                              :with_subprojects => @with_subprojects,
 7                                                              :author => @author)
 8     @activity.scope_select {|t| !params["show_#{t}"].nil?}
 9-    @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
10+    @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? unless params[:set_filter] == "1" 
11
12     events = @activity.events(@date_from, @date_to)
13
14diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
15index 173b750..4d9c4b0 100644
16--- a/app/views/activities/index.html.erb
17+++ b/app/views/activities/index.html.erb
18@@ -42,7 +42,8 @@
19 <% content_for :sidebar do %>
20 <% form_tag({}, :method => :get) do %>
21 <h3><%= l(:label_activity) %></h3>
22-<p><% @activity.event_types.each do |t| %>
23+<% hidden_field_tag "set_filter", 1, :id => nil %>
24+<p><% @activity.event_types.each do |t| %><%= hidden_field_tag "show_#{t}", 0, :id => nil%>
25 <%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
26 <label for="show_<%=t%>"><%= link_to(l("label_#{t.singularize}_plural"), {"show_#{t}" => 1, :user_id => params[:user_id]})%></label>
27 <br />

Updated by Felix Schäfer at 2012-03-20 09:31 pm

Holger Just wrote:

An alternative variant could be to use a set_filter field, as we don now with issues.

Not sure if I like that solution that much either, but if it's one that's already used somewhere else, it's probably better than nothing until we've refactored the whole thing.

The code looks fine to me, commit at will.

  • Assignee set to Holger Just
  • Status changed from Open to Ready for review

Updated by Felix Schäfer at 2012-03-28 06:33 pm

Committed with a test, thanks!

  • Assignee deleted (Holger Just)
  • Status changed from Ready for review to Closed

Also available in: Atom PDF