ergoserv / redmine-progressive-projects-list

⛏️ Redmine plugin that powers a project list with progress bars for every project and version.
https://ergoserv.github.io/redmine-progressive-projects-list/
MIT License
109 stars 57 forks source link

Update to Redmine 3.4.2 #82

Closed Nemezius closed 4 years ago

Nemezius commented 6 years ago

@stgeneral May I please ask you to update the plugin for Redmine 3.4.2 as currently it cannot be installed on Rm 3.4.2-Stable?

Thank you.

stgeneral commented 6 years ago

Thank you for a report. What error do you get? Are they look same to errors described in #76?

Nemezius commented 6 years ago

Sorry for my late reply- yes, the error was the same and, dunno how, but a day later the plugin stalled without any error but it behaves a bit suspiciously- it shows a progress of a 100% for any project the that has any issues/tasks associated with the project. For example, A project with 10 Open and 3 Finished and Due date in 43 days is reported as 100%:

snip1 snip2

I see that the progress bar is generated by this code in projects_helper_patch.rb: s << progress_bar([project.issues_closed_percent, project.issues_completed_percent], :width => '30em', :legend => '%0.0f%' % project.issues_closed_percent)

As far as I can see, the issues_closed_percent comes from project_decorator.rb but I cannot really where in the code should the progress be calculated as it looks like it gives either 0% or 100%, unless it is calculated via issues_progress(false) to which I find this reference:

Cloned from Version#issues_progress(open)

def issues_progress(open) @issues_progress ||= {} @issues_progress[open] ||= begin progress = 0 if issues.count > 0 ratio = open ? 'done_ratio' : 100

    done = issues.sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{estimated_average}) * #{ratio}",
                              :joins => :status,
                              :conditions => ["#{IssueStatus.table_name}.is_closed = ?", !open]).to_f
    progress = done / (estimated_average * issues.count)
  end
  progress
end

end

Cloned from Version#completed_pourcent

def issues_completed_percent if issues.count == 0 0 elsif issues.open.count == 0 100 else issues_progress(false) + issues_progress(true) end end

What could be wrong with those(except that I cannot understand the meaning of passing true and false as arguments to issue_progress() but this should be something R-specific I guess.

stgeneral commented 4 years ago

Fixed in #90.