Giter VIP home page Giter VIP logo

Comments (10)

kulesa avatar kulesa commented on August 20, 2024

I know about this issue but haven't done anything yet. The plugin is only compatible with 1.1.2 stable. I currently just don't have time to maintain few versions of the plugin (I already have 2 to maintain - one compatible with 1.1.2 and the other compatible with patch #2024).

But you can fork the repo and patch the plugin for your version Redmine. Here is how you do it. I quickly checked that this method call is in 'render_project_with_cross_project_issues' method. As you can see from the 'alias_method_chain' statement, this is a replacement of the original 'render_project' method. So you need to check how this 'for_gantt' call was changed in the original lib/redmine/helpers/gantt.rb in your version of Redmine and change 'render_project_with_croww_project_issues' accordingly. I hope this make sense :)

The other option is to wait for 1.2 release - I'll update the plugin for it as soon as it is stable.

from redmine_better_gantt_chart.

blackfist avatar blackfist commented on August 20, 2024

OK, I don't know how I closed the issue and I don't know how to open it back up. Anyway, I'll keep playing with it and if I get some working code I'll forward it over to you.

from redmine_better_gantt_chart.

blackfist avatar blackfist commented on August 20, 2024

Looking over the repository, it looks like the for_gantt code was removed from app/models/issue.rb in revision 5079 with a comment of code cleanup. That appears to be the only change in that revision was removing the named scope.

from redmine_better_gantt_chart.

kulesa avatar kulesa commented on August 20, 2024

Then it's just enough to change

project.issues.for_gantt.without_version ...

to

project.issues.without_version ...

from redmine_better_gantt_chart.

blackfist avatar blackfist commented on August 20, 2024

I totally understand not wanting to maintain multiple versions, and chase a moving target like trunk. I just figure that 1.2 is going to be stable soon so it's probably a good time to start figuring out what changed. But before I dove in too deep I wanted to be sure that you hadn't already done all the work.

from redmine_better_gantt_chart.

blackfist avatar blackfist commented on August 20, 2024

OK, made that change. Now I'm seeing a database error.
ActionView::TemplateError (Mysql::Error: Unknown column 'projects.id' in 'where clause': SELECT issues.id AS t0_r0,
issues.tracker_id AS t0_r1, issues.project_id AS t0_r2, issues.subject AS t0_r3, issues.description AS t0_r4,
issues.due_date AS t0_r5, issues.category_id AS t0_r6, issues.status_id AS t0_r7, issues.assigned_to_id AS t0_r8,
issues.priority_id AS t0_r9, issues.fixed_version_id AS t0_r10, issues.author_id AS t0_r11,
issues.lock_version AS t0_r12, issues.created_on AS t0_r13, issues.updated_on AS t0_r14,
issues.start_date AS t0_r15, issues.done_ratio AS t0_r16, issues.estimated_hours AS t0_r17,
issues.parent_id AS t0_r18, issues.root_id AS t0_r19, issues.lft AS t0_r20, issues.rgt AS t0_r21,
issues.is_private AS t0_r22, issue_statuses.id AS t1_r0, issue_statuses.name AS t1_r1,
issue_statuses.is_closed AS t1_r2, issue_statuses.is_default AS t1_r3, issue_statuses.position AS t1_r4,
issue_statuses.default_done_ratio AS t1_r5, trackers.id AS t2_r0, trackers.name AS t2_r1,
trackers.is_in_chlog AS t2_r2, trackers.position AS t2_r3, trackers.is_in_roadmap AS t2_r4
FROM issues
LEFT OUTER JOIN issue_statuses ON issue_statuses.id = issues.status_id
LEFT OUTER JOIN trackers ON trackers.id = issues.tracker_id
WHERE (((((issues.tracker_id IN ('6')) AND (issues.due_date <= '2011-04-26 23:59:59') AND (issue_statuses.is_closed=0) AND projects.id = 5))
AND (issues.fixed_version_id IS NULL)) AND (issues.project_id = 5))
ORDER BY issues.created_on DESC LIMIT 499) on line #58 of vendor/plugins/redmine_better_gantt_chart/app/views/gantts/show.html.erb:

55: # Width of the entire chart
56: g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
57:
58: @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width)
59:
60: g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
61: t_height = g_height + headers_height

Which is strange because the column that it is complaining about seems to exist.
mysql> desc projects;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | | |
| description | text | YES | | NULL | |
| homepage | varchar(255) | YES | | | |
| is_public | tinyint(1) | NO | | 1 | |
| parent_id | int(11) | YES | | NULL | |
| created_on | datetime | YES | | NULL | |
| updated_on | datetime | YES | | NULL | |
| identifier | varchar(255) | YES | | NULL | |
| status | int(11) | NO | | 1 | |
| lft | int(11) | YES | MUL | NULL | |
| rgt | int(11) | YES | MUL | NULL | |
+-------------+--------------+------+-----+---------+----------------+
12 rows in set (0.00 sec)

from redmine_better_gantt_chart.

kulesa avatar kulesa commented on August 20, 2024

Seems like 'projects' table is not in 'from' or 'joint' lists. I think some part of the query is formed in one of the methods redefined in plugin.

Sent from iPhone

26.04.2011, в 18:46, [email protected] написал(а):

OK, made that change. Now I'm seeing a database error.
ActionView::TemplateError (Mysql::Error: Unknown column 'projects.id' in 'where clause': SELECT issues.id AS t0_r0,
issues.tracker_id AS t0_r1, issues.project_id AS t0_r2, issues.subject AS t0_r3, issues.description AS t0_r4,
issues.due_date AS t0_r5, issues.category_id AS t0_r6, issues.status_id AS t0_r7, issues.assigned_to_id AS t0_r8,
issues.priority_id AS t0_r9, issues.fixed_version_id AS t0_r10, issues.author_id AS t0_r11,
issues.lock_version AS t0_r12, issues.created_on AS t0_r13, issues.updated_on AS t0_r14,
issues.start_date AS t0_r15, issues.done_ratio AS t0_r16, issues.estimated_hours AS t0_r17,
issues.parent_id AS t0_r18, issues.root_id AS t0_r19, issues.lft AS t0_r20, issues.rgt AS t0_r21,
issues.is_private AS t0_r22, issue_statuses.id AS t1_r0, issue_statuses.name AS t1_r1,
issue_statuses.is_closed AS t1_r2, issue_statuses.is_default AS t1_r3, issue_statuses.position AS t1_r4,
issue_statuses.default_done_ratio AS t1_r5, trackers.id AS t2_r0, trackers.name AS t2_r1,
trackers.is_in_chlog AS t2_r2, trackers.position AS t2_r3, trackers.is_in_roadmap AS t2_r4
FROM issues
LEFT OUTER JOIN issue_statuses ON issue_statuses.id = issues.status_id
LEFT OUTER JOIN trackers ON trackers.id = issues.tracker_id
WHERE (((((issues.tracker_id IN ('6')) AND (issues.due_date <= '2011-04-26 23:59:59') AND (issue_statuses.is_closed=0) AND projects.id = 5))
AND (issues.fixed_version_id IS NULL)) AND (issues.project_id = 5))
ORDER BY issues.created_on DESC LIMIT 499) on line #58 of vendor/plugins/redmine_better_gantt_chart/app/views/gantts/show.html.erb:

55: # Width of the entire chart
56: g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
57:
58: @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width)
59:
60: g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
61: t_height = g_height + headers_height

Which is strange because the column that it is complaining about seems to exist.
mysql> desc projects;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | | |
| description | text | YES | | NULL | |
| homepage | varchar(255) | YES | | | |
| is_public | tinyint(1) | NO | | 1 | |
| parent_id | int(11) | YES | | NULL | |
| created_on | datetime | YES | | NULL | |
| updated_on | datetime | YES | | NULL | |
| identifier | varchar(255) | YES | | NULL | |
| status | int(11) | NO | | 1 | |
| lft | int(11) | YES | MUL | NULL | |
| rgt | int(11) | YES | MUL | NULL | |
+-------------+--------------+------+-----+---------+----------------+
12 rows in set (0.00 sec)

Reply to this email directly or view it on GitHub:
#16 (comment)

from redmine_better_gantt_chart.

blackfist avatar blackfist commented on August 20, 2024

Purely for readability purposes, I have broken down the SQL statement here. No changes to what is above, but easier to grok.
SELECT issues.id AS t0_r0,
issues.tracker_id AS t0_r1,
issues.project_id AS t0_r2,
issues.subject AS t0_r3,
issues.description AS t0_r4,
issues.due_date AS t0_r5,
issues.category_id AS t0_r6,
issues.status_id AS t0_r7,
issues.assigned_to_id AS t0_r8,
issues.priority_id AS t0_r9,
issues.fixed_version_id AS t0_r10,
issues.author_id AS t0_r11,
issues.lock_version AS t0_r12,
issues.created_on AS t0_r13,
issues.updated_on AS t0_r14,
issues.start_date AS t0_r15,
issues.done_ratio AS t0_r16,
issues.estimated_hours AS t0_r17,
issues.parent_id AS t0_r18,
issues.root_id AS t0_r19,
issues.lft AS t0_r20,
issues.rgt AS t0_r21,
issues.is_private AS t0_r22,
issue_statuses.id AS t1_r0,
issue_statuses.name AS t1_r1,
issue_statuses.is_closed AS t1_r2,
issue_statuses.is_default AS t1_r3,
issue_statuses.position AS t1_r4,
issue_statuses.default_done_ratio AS t1_r5,
trackers.id AS t2_r0,
trackers.name AS t2_r1,
trackers.is_in_chlog AS t2_r2,
trackers.position AS t2_r3,
trackers.is_in_roadmap AS t2_r4
FROM issues
LEFT OUTER JOIN issue_statuses ON issue_statuses.id = issues.status_id
LEFT OUTER JOIN trackers ON trackers.id = issues.tracker_id
WHERE (((((issue_statuses.is_closed=0) AND projects.id = 1)) AND (issues.fixed_version_id IS NULL)) AND (issues.project_id = 1))
ORDER BY issues.created_on DESC LIMIT 499);

from redmine_better_gantt_chart.

kulesa avatar kulesa commented on August 20, 2024

I found this for_gantt thing was there for purpose, here is an excerpt from the old issue.rb:

named_scope :for_gantt, lambda {
  {
    :include => [:tracker, :status, :assigned_to, :priority, :project, :fixed_version]
  }
}

It adds these tables to FROM clause, tnd without it the query fails on 'projects.id = 1' because projects table is not there. In fact, this code wasn't just removed: in revision 5077 preparation of this query moved to gantt.rb.

The easiest thing would be to add for_gantt scope back to issue.rb, BUT you will just get the next error. For example, on 'version.fixed_issues' statement which also was removed. So I would instead do what you did with show.html.erb: compare methods redefined in plugin with the original methods in 1.1.2 stable, find out the difference and try to apply the same changes to the methods from the latest Redmine revision.

from redmine_better_gantt_chart.

kulesa avatar kulesa commented on August 20, 2024

Plugin updated to work with trunk Redmine and will likely work with Redmine 1.2 as well.

from redmine_better_gantt_chart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.