Project

General

Profile

Actions

Patch #7456

open

Gantt filters

Added by Etienne Massip almost 14 years ago. Updated over 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Gantt
Start date:
2011-01-26
Due date:
% Done:

0%

Estimated time:

Description

This patch fixes a number of issues related to Gantt display (#6300, #6605, #7000, #7352, #6476, #5817) :

  • query filters (project, subproject, versions, etc.) should work fine now
  • renders fine the project / version / subproject / issue, etc. hierarchy
  • does not render anymore empty versions or projects
  • issues are sorted by start_date (issue without any start_date are listed after the others)
  • maybe a bit faster (~30% on my Gantt) and there is still room for enhancement

Previous tests pass, Gantt tests "#number of rows in project" have been removed (now meaningless).
New tests still to come.

Not tested yet with MySQL, tested with pg 8.4 and 9.0, sqlite3. Works with every supported DBs.

Comments and feedback are welcome.


Files

gantt.jpg (153 KB) gantt.jpg Dmit nitkin, 2011-02-04 14:53
gantt_filters.patch (35 KB) gantt_filters.patch v2 Etienne Massip, 2011-02-04 15:05
patch.log (2.67 KB) patch.log patch log on r5021 Etienne Massip, 2011-03-07 14:10
patched.zip (25 KB) patched.zip Etienne Massip, 2011-03-07 16:05
patch_unified_diff.zip (30.9 KB) patch_unified_diff.zip Zip file with patches & difference B Brey, 2011-03-08 09:48
patched_1.1.0.zip (24.1 KB) patched_1.1.0.zip 1.1.0 Etienne Massip, 2011-03-08 11:52
patched_1.1.1.zip (24 KB) patched_1.1.1.zip 1.1.1 Etienne Massip, 2011-03-08 11:52
patch_unified_diff_1.1.zip (30.7 KB) patch_unified_diff_1.1.zip B Brey, 2011-03-08 12:09

Related issues

Related to Redmine - Feature #6300: Add a filter for items displayed in gantt view (version, issues)New2010-09-05

Actions
Related to Redmine - Feature #6605: Provide simple way of hiding completed versions from a gantt chartClosed2010-10-07

Actions
Related to Redmine - Defect #7000: Project filter not applied on versions in Gantt chartClosed2010-11-29

Actions
Related to Redmine - Defect #7352: Filters not working in Gantt chartsClosed2011-01-17

Actions
Related to Redmine - Defect #5817: Shared versions not shown in subproject's gantt chartClosed2010-07-05

Actions
Related to Redmine - Defect #6476: Subproject's issues are not shown in the subproject's ganttClosed2010-09-23

Actions
Related to Redmine - Defect #6604: Issues targeted at parent project versions' are not shown on gantt chartClosed2010-10-07

Actions
Related to Redmine - Feature #4786: Gantt Chart - Grouping issues by target versionClosed2010-02-10

Actions
Related to Redmine - Defect #7114: New gantt doesn't display some projectsClosedJean-Baptiste Barth2010-12-15

Actions
Related to Redmine - Defect #7335: Sorting issues in gantt by date, not by idClosedToshi MARUYAMA2011-01-15

Actions
Related to Redmine - Defect #5989: Gantt subtasking display brokenClosed2010-07-29

Actions
Related to Redmine - Feature #5881: Subtasks do not always appear below the parent task in Gantt chart -> a job for a custom filter?Closed2010-07-14

Actions
Actions #1

Updated by Etienne Massip almost 14 years ago

  • File deleted (gantt_filters.patch)
Actions #2

Updated by Etienne Massip almost 14 years ago

  • File gantt_filters.htm added

My bad, missed broken tests.

Actions #3

Updated by Etienne Massip almost 14 years ago

  • File deleted (gantt_filters.htm)
Actions #4

Updated by Etienne Massip almost 14 years ago

  • File gantt_filters.patch added

This is the good one.

Actions #5

Updated by Jean-Philippe Lang almost 14 years ago

That's a big patch that is supposed to fix several defects and no tests are included.
I think it should be split into smaller ones that fix a specific issue, with each of them including test(s) for the fix.

Actions #6

Updated by Etienne Massip almost 14 years ago

  • File gantt_filters_render.patch added
  • File gantt_filters_issue_compare.patch added

I think I can just split it into 2 patches : the first one one for the rendering algorithm which is about 95% of modified code and the second one for issue sorting which is a very tiny one. Both are attached.

It may look a big patch but just a few methods are actually modified ; that is mainly the render() method and its callees.

About the tests, you're right but there are Gantt tests already and I'm not used to writing ruby tests so it'll take a bit more time (and there is quite a bunch of work to go).

That's also why I posted the patch : to get some feedback to be sure I'm not going straight to the wrong direction before writing the tests.

Actions #7

Updated by Etienne Massip almost 14 years ago

  • File deleted (gantt_filters_issue_compare.patch)
Actions #8

Updated by Etienne Massip almost 14 years ago

  • File gantt_filters_issue_compare.patch added
Actions #9

Updated by Dmit nitkin almost 14 years ago

Great!
I couldn't apply gantt_filters_render.patch and then apply gantt_filters_issue_compare.patch (I used tortoise svn and get conflict on second patch) so I applied gantt_filters.patch (I guess it combines both this patches)
I found an error showed in attached file. "test2" is subproject of "testpr" and there are two test2 projects. One with versioned issue and other with unversioned issue. Also I think version "testprVersion" should be before subprojects because it belongs to testpr

Actions #10

Updated by Etienne Massip almost 14 years ago

Glad I have someone to help !

I knew this bug, this is the only one remaining AFAIK ; I thought I would upload the final version with associated tests I'm actually trying to write.

Anyway, here's the fixed .patch file (just fixed the .patch file itself directly from memory, hope it will be Ok).

Thanks for your feedback !

Actions #11

Updated by Alcnedlor Nuratar almost 14 years ago

I tried the new .patch but there is a conflict with query.rb

Since my redmine is in production, I couldn't try to understand the issue and reverted
I'll let you know if I find the cause

I have a question though, don't you think it would be best to display only projects that have tickets displayed in them ? For example, if I select an Assignee, all my projects are listed even if the assignee is not part of it.

Regards

Actions #12

Updated by Etienne Massip almost 14 years ago

Alcnedlor Nuratar wrote:

I tried the new .patch but there is a conflict with query.rb

Since my redmine is in production, I couldn't try to understand the issue and reverted
I'll let you know if I find the cause

I just tried on trunk and had no conflict ; since query.rb hasn't been modified since 1.1.1 was released, it should work with stable too.

I have a question though, don't you think it would be best to display only projects that have tickets displayed in them ? For example, if I select an Assignee, all my projects are listed even if the assignee is not part of it.

Well, the patch actually change this behavior : only projects and versions with issues not filtered out are displayed.

Actions #13

Updated by Alcnedlor Nuratar almost 14 years ago

Thank you for the quick answer and I must apologize, I should have looked more deeply

I have a conflict, that's the truth... but I don't really know why
The line
(filters_clauses << project_statement(Issue.table_name)).join(' AND ')
was not updated correctly

Except for this little trick, the patch works great

Thank you

Actions #14

Updated by Etienne Massip almost 14 years ago

Alcnedlor Nuratar wrote:

Thank you for the quick answer and I must apologize, I should have looked more deeply

I have a conflict, that's the truth... but I don't really know why
The line
(filters_clauses << project_statement(Issue.table_name)).join(' AND ')
was not updated correctly

What's your redMine version ? 1.1.1 ? How did you apply the patch ?

Except for this little trick, the patch works great

If you could give me some feedback, that would be great !

Thanks !

Actions #15

Updated by Alcnedlor Nuratar almost 14 years ago

Hum,

I have currently Redmine 1.1.1 (2011-01-30)
To apply the patch, I used
patch -p0 < gantt_filters.patch

Otherwise, I don't know what to report :-)

  • It is now possible to filter by projects
  • Only projects that contains non-filtered tasks are displayed
  • Issues are correctly sorted by started date (older first)
  • also, if I clear every filters, I think that more issues are displayed (but it's just an impression, nothing scientific in the test)

My DB is MySQL also, so this seems be DB independent

That's all for now

Actions #16

Updated by Etienne Massip almost 14 years ago

Perfect, thanks a lot !

I now know that it works with MySQL too =)

Actions #17

Updated by Chris Darts over 13 years ago

I've just tried to run the gantt_filters.patch (v2) on v1.1.1 and it failed with the following error message:

(Stripping trailing CRs from patch.)
patching file app/models/issue.rb
(Stripping trailing CRs from patch.)
patching file app/models/query.rb
(Stripping trailing CRs from patch.)
patching file lib/redmine/helpers/gantt.rb
Hunk #3 succeeded at 99 (offset 1 line).
Hunk #4 FAILED at 115.
Hunk #5 succeeded at 301 (offset 22 lines).
Hunk #6 FAILED at 299.
Hunk #7 succeeded at 364 with fuzz 1 (offset 38 lines).
Hunk #8 succeeded at 402 (offset 41 lines).
Hunk #9 succeeded at 434 (offset 41 lines).
Hunk #10 succeeded at 466 (offset 41 lines).
Hunk #11 succeeded at 483 (offset 41 lines).
Hunk #12 succeeded at 491 (offset 41 lines).
Hunk #13 succeeded at 503 (offset 41 lines).
Hunk #14 succeeded at 521 (offset 41 lines).
Hunk #15 succeeded at 537 (offset 41 lines).
Hunk #16 succeeded at 557 (offset 41 lines).
Hunk #17 succeeded at 583 (offset 41 lines).
Hunk #18 succeeded at 600 (offset 41 lines).
Hunk #19 FAILED at 580.
Hunk #20 succeeded at 723 (offset 123 lines).
Hunk #21 succeeded at 733 (offset 123 lines).
Hunk #22 succeeded at 746 (offset 123 lines).
Hunk #23 succeeded at 754 (offset 123 lines).
Hunk #24 succeeded at 794 (offset 123 lines).
Hunk #25 succeeded at 809 with fuzz 2 (offset 123 lines).
Hunk #26 succeeded at 817 (offset 123 lines).
Hunk #27 succeeded at 892 (offset 140 lines).
3 out of 27 hunks FAILED -- saving rejects to file lib/redmine/helpers/gantt.rb.rej
(Stripping trailing CRs from patch.)
patching file test/unit/lib/redmine/helpers/gantt_test.rb

Any help would be much appreciated.

Actions #18

Updated by Etienne Massip over 13 years ago

Are you using 1.1.1 stable or trunk ?

Actions #19

Updated by Etienne Massip over 13 years ago

I guess you are trying to patch an already patched lib/redmine/helpers/gantt.rb with #2024.

That is a bit touchy as this patch (gantt_filters) is quite a bit destructive, you'll have to patch some part by hand.

Actions #20

Updated by Chris Darts over 13 years ago

Yes, sorry I forgot to mention that I had applied the patch under #2024 beforehand.

Ideally I would like to use both patches as they seem to offer the perfect combination of what I need to achieve using the gantt chart. I guess it isn't that easy at the moment?

I'm fairly new to Redmine and even more so to patches, so I'm not sure how comfortable I would be to do some of the patching by hand. Any help or advise would be greatly received.

I'm currently setting up a separate instance of Redmine to try your patch on it's own, without the gantt chart editing in issue #2024. I'll let you know how that goes.

Actions #21

Updated by Chris Darts over 13 years ago

I've just tried this patch on a fresh install of Redmine 1.1.1 (taken from the svn repository) and it seems to work fine now. Looks like the conflict was indeed with another gantt chart patch #2024.

My only question now is that the gantt chart doesn't seem to appear any different from how it looked pre-patch. I have only run the 'gantt_filters.patch' (v2), as I'm not sure if the 'gantt_filters_render.patch' and 'gantt_filters_issue_compare.patch' are still relevant.

I'm just wondering if most of the issues fixed with this patch are now in the core system, which I why I'm not seeing any difference.

Can anyone highlight the main issues this patch is intended to resolve and if it's still necessary with 1.1.1. Should I also be applying the other 2 patches as listed above?

Thanks.

Actions #22

Updated by Etienne Massip over 13 years ago

  • File deleted (gantt_filters_issue_compare.patch)
Actions #23

Updated by Etienne Massip over 13 years ago

  • File deleted (gantt_filters.patch)
Actions #24

Updated by Etienne Massip over 13 years ago

  • File deleted (gantt_filters_render.patch)
Actions #25

Updated by Etienne Massip over 13 years ago

I just removed remaining irrelevant patches.

As for what it does, I thought that the list in the description was pretty clear :(

Mostly, projects and versions which have no issue related are not displayed anymore, query filters are all taken into account and issue sorting is a bit more precise.

And no, it has not been incorporated to core.

Actions #26

Updated by Chris Darts over 13 years ago

Thanks Etienne, I appreciate your quick response.

The list is pretty clear, but it just made me wonder as I didn't see any difference on my system. It's probably because I was only viewing one test project and didn't look at it across all projects. Now I look at all projects and issues I can see the improvements. Sorry, this was my fault.

Thanks for removing the redundant files, this will be a big help for anyone new to this thread.

Actions #27

Updated by Etienne Massip over 13 years ago

  • Target version set to Candidate for next major release
Actions #28

Updated by B Brey over 13 years ago

I tried to patch 1.1.1.stable.5000 but to no avail.

patch -p0 < gantt_filters.patch

Failed with on all points, what am I doing wrong?

Actions #29

Updated by Etienne Massip over 13 years ago

You may have already applied another patch on your gantt ?

If not, try with -p1.

Actions #30

Updated by B Brey over 13 years ago

Etienne Massip wrote:

You may have already applied another patch on your gantt ?

If not, try with -p1.

No but tried it anyway and it didn't work, any chance on this being fixed soon in a release? Because this breaks the gantt charting :(

Actions #31

Updated by Etienne Massip over 13 years ago

Just done it on r5000 without any problem, and this patch is still applicable on trunk.

What failures were you talking about, exactly ?

Please revert your changes on lib/redmine/helpers/gantt.rb, app/models/issue.rb and app/models/query.rb before patching.

Actions #32

Updated by B Brey over 13 years ago

Etienne Massip wrote:

Just done it on r5000 without any problem, and this patch is still applicable on trunk.

What failures were you talking about, exactly ?

Please revert your changes on lib/redmine/helpers/gantt.rb, app/models/issue.rb and app/models/query.rb before patching.

I'm at revision 5022 btw. Really don't know what i am doing wrong.

patch -p0 < gantt_filters.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: app/models/issue.rb
|===================================================================
|--- app/models/issue.rb        (revision 4761)
|+++ app/models/issue.rb        (working copy)
--------------------------
Patching file app/models/issue.rb using Plan A...
Hunk #1 failed at 17.
Hunk #2 failed at 68.
Hunk #3 failed at 75.
3 out of 3 hunks failed--saving rejects to app/models/issue.rb.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: app/models/query.rb
|===================================================================
|--- app/models/query.rb        (revision 4761)
|+++ app/models/query.rb        (working copy)
--------------------------
Patching file app/models/query.rb using Plan A...
Hunk #1 failed at 388.
Hunk #2 failed at 434.
Hunk #3 failed at 443.
Hunk #4 failed at 496.
Hunk #5 failed at 508.
Hunk #6 failed at 537.
Hunk #7 failed at 569.
7 out of 7 hunks failed--saving rejects to app/models/query.rb.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: lib/redmine/helpers/gantt.rb
|===================================================================
|--- lib/redmine/helpers/gantt.rb       (revision 4761)
|+++ lib/redmine/helpers/gantt.rb       (working copy)
--------------------------
Patching file lib/redmine/helpers/gantt.rb using Plan A...
Hunk #1 failed at 38.
Hunk #2 failed at 53.
Hunk #3 failed at 98.
Hunk #4 failed at 115.
Hunk #5 failed at 429.
Hunk #6 failed at 449.
Hunk #7 failed at 471.
Hunk #8 failed at 506.
Hunk #9 failed at 538.
Hunk #10 failed at 570.
Hunk #11 failed at 587.
Hunk #12 failed at 595.
Hunk #13 failed at 607.
Hunk #14 failed at 625.
Hunk #15 failed at 641.
Hunk #16 failed at 661.
Hunk #17 failed at 687.
Hunk #18 failed at 704.
Hunk #19 failed at 725.
Hunk #20 failed at 745.
Hunk #21 failed at 755.
Hunk #22 failed at 768.
Hunk #23 failed at 776.
Hunk #24 failed at 816.
Hunk #25 failed at 831.
Hunk #26 failed at 839.
Hunk #27 failed at 897.
27 out of 27 hunks failed--saving rejects to lib/redmine/helpers/gantt.rb.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: test/unit/lib/redmine/helpers/gantt_test.rb
|===================================================================
|--- test/unit/lib/redmine/helpers/gantt_test.rb        (revision 4761)
|+++ test/unit/lib/redmine/helpers/gantt_test.rb        (working copy)
--------------------------
Patching file test/unit/lib/redmine/helpers/gantt_test.rb using Plan A...
Hunk #1 failed at 91.
1 out of 1 hunks failed--saving rejects to test/unit/lib/redmine/helpers/gantt_test.rb.rej
Actions #33

Updated by Etienne Massip over 13 years ago

Here's my patch -p0 --verbose < gantt_filters.patch results on r5021 (windows).

Sorry, I've no clue why yours just fail. I suppose that your cwd is redmine ?

Actions #34

Updated by B Brey over 13 years ago

Etienne Massip wrote:

Here's my patch -p0 --verbose < gantt_filters.patch results on r5021 (windows).

Sorry, I've no clue why yours just fail. I suppose that your cwd is redmine ?

Yes it's the current working directory, /home/www/redmine-1.1/

I'm running FreeBSD by the way.

Actions #35

Updated by Etienne Massip over 13 years ago

Here are the files once patched, could you create a patch and compare both patches which each other ?

Actions #36

Updated by B Brey over 13 years ago

Etienne Massip wrote:

Here are the files once patched, could you create a patch and compare both patches which each other ?

Very weird, this patch is very different. I deleted the 3 files and got them fresh from the 1.1 repository
I included both patches + diff file in the zip.

Actions #37

Updated by Etienne Massip over 13 years ago

I guess that's mostly because patched files I sent to you where based on r5021.

Could you please do the same thing again, this time with the files matching your redmine (I uploaded 2 archives : one for 1.1.1 / r4786 and one for 1.1.0 / r4672) ?

Actions #38

Updated by B Brey over 13 years ago

Etienne Massip wrote:

I guess that's mostly because patched files I sent to you where based on r5021.

Could you please do the same thing again, this time with the files matching your redmine (I uploaded 2 archives : one for 1.1.1 / r4786 and one for 1.1.0 / r4672) ?

Done!

Actions #39

Updated by Jean-Philippe Lang over 13 years ago

I've just committed some changes to the gantt chart rendering in r5077.
It should basically implements the changes proposed in the patch, except the issue sort change.

Actions #40

Updated by Etienne Massip over 13 years ago

You're a damn good coder, nice clean code !

I think you've fixed #6605 too, didn't you ?

I'll run some tests tomorrow, the few ones I wrote til now all passe =)

Guess you can remove the Issue#for_gantt scope too ?
And maybe the GanttHelper#number_of_issues_on_versions, I can't find any use of it in the project ?

Actions #41

Updated by Jean-Philippe Lang over 13 years ago

Thanks :-)

Etienne Massip wrote:

Guess you can remove the Issue#for_gantt scope too ?
And maybe the GanttHelper#number_of_issues_on_versions, I can't find any use of it in the project ?

Cleanup done. There's maybe more to do.

Actions #42

Updated by Etienne Massip over 13 years ago

There's still at least 1 glitch :

If a subproject issue is targeted to the parent project shared version, its path is rendered as :

parent -> subproject -> shared version -> shared version issues (including parent issues)

It should be :
parent -> shared version -> subproject -> shared version issues (including parent issues)

Here, parent is what I named "top_version_project" in the patch, this is the project the version should be rendered aside.

Actions #43

Updated by Jean-Philippe Lang over 13 years ago

The current implementation actually gives what I was expecting (and what is expected in #6476 note-2).
I think it makes sense to display the shared version under the subproject, not the opposite.

Actions #44

Updated by Etienne Massip over 13 years ago

I disagree : Gantt is a planning tool and you're planning your issue around a version and then, or if there is no version, around a project.

What note-2 is proposing is to follow the project first and your version second which is wrong to me (you split your version in several Gantt branches).

Actions #45

Updated by Etienne Massip over 13 years ago

About #6476, I think that rendering should be different in function of context project.

Version's project Gantt :

parent -> shared version -> subproject -> shared version issues (including parent issues)

Subproject Gantt :

subproject -> shared version  -> shared version issues (excluding parent issues)

Actions #46

Updated by Chris Darts over 13 years ago

Jean-Philippe Lang wrote:

I've just committed some changes to the gantt chart rendering in r5077.
It should basically implements the changes proposed in the patch, except the issue sort change.

I'm interested to find out why the issue sort change was not included in this update.

I've just tested 1.2.0 and there are a number of improvements on the Gantt chart, some or most of which I assuming originated from this patch. However, it seems there is no way to influence the sort order issues in the Gantt chart, with the default being the issue id. It would be great if the Gantt could take the sorting order from the issue list or after selecting a specific custom query from the sidebar.

Are there any plans to incorporate the missing aspects from this patch, in particular the sort issue, into Redmine core in the near future?

Thanks.

Actions #47

Updated by Martin Wall over 12 years ago

  • Assignee set to Etienne Massip

Can you add a ticket related to this gant chart improvement?
http://www.redmine.org/boards/4/topics/14801?r=20375#message-20375

Actions #48

Updated by Etienne Massip over 12 years ago

  • Assignee deleted (Etienne Massip)

Please don't assign issues.

Actions #49

Updated by Jonathan Vargas almost 12 years ago

I am using redmine 2.2.0 and the sort by start_date issue is a feature I would appreciate, as reported on several issues.

Current sorting by issue_id doesn't provides usable sorting at all, since most of time the issues are not created sequentially in the same order that they should be executed.

The fix for this is very easy, I applied it quickly on 2.2.0. Is there a known reason to postpone it?

Thanks.

Actions #50

Updated by Daniel Felix almost 12 years ago

Here are some other patches which solves some gantt sort issues too: #8366

Actions #51

Updated by Artem Kondratyev about 11 years ago

Is there a possibility to add sort by due_date too? It's much more needed when talking about Network planning and design

Actions #52

Updated by Alessandro Zucchi over 4 years ago

+1

Actions

Also available in: Atom PDF