diff --git a/README.md b/README.md
index 425f783..83e7fd7 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,18 @@
Progressive Projects List
=========================
-[](http://www.redmine.org/plugins/progressive-projects-list)
-
-Plugin loads [Redmine](http://www.redmine.org/)'s projects list with overall projects status.
-
-One of the [5 Redmine Plugins that will change the way you work](http://it-consultis.com/blog/5-redmine-plugins-will-change-way-work/) by [Thomas Guillemaud](http://it-consultis.com/author/thomas/) from [IT Consultis]
-(http://it-consultis.com/).
+Projects list with blackjack and other features for [Redmine](http://www.redmine.org/).
Features
--------
-- Show overall projects status in progress bars
+- Show overall projects status in progress bars (progress can be calculated based on the hours spent/left or simply on the ratio of tickets closed - configurable)
- Show project status in progress bars at project overview page
- Quick links to issues, new issue, version, etc directly from the projects list
- Show due date of the projects and versions
- Recently viewed projects sidebar block
- Configurable: admin set default settings, user may override them per session
-- Translated into 12 languages: English, German, French, Italian, Spanish, Portuguese, Traitional and Simplified Chinese, Japanese, Russian, Ukrainian, Polish.
+- Translated into 7 languages: English, German, French, Italian, Simplified Chinese, Russian, Ukrainian.

@@ -26,38 +21,15 @@ More details and screenshots - http://stgeneral.github.io/redmine-progressive-pr
Installation notes
------------------
-1. Download [latest release](https://github.com/stgeneral/redmine-progressive-projects-list/releases/latest) of the plugin.
-2. Extract it to ` <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
<%= check_box_tag :show_only_for_my_projects, 1, progressive_setting?(:show_only_for_my_projects) %>
- <%= label_tag :show_only_for_my_projects, l(:setting_show_only_for_my_projects) %>
- <%= check_box_tag :show_recent_projects, 1, progressive_setting?(:show_recent_projects) %>
- <%= label_tag :show_recent_projects, l(:setting_show_recent_projects) %>
+ <%= label_tag :show_only_for_my_projects, l(:setting_show_only_for_my_projects) %>
+ <%= check_box_tag :ignore_hours, 1, progressive_setting?(:ignore_hours) %>
+ <%= label_tag :ignore_hours, l(:setting_ignore_hours) %>
+ <%= setting_label(:ignore_hours) %> + <%= check_box_tag('settings[ignore_hours]', true, @settings['ignore_hours']) %> +
<%= setting_label(:show_project_progress_overview) %> <%= select_tag('settings[show_project_progress_overview]', @@ -25,8 +29,4 @@ [l(:progressive_option_right), 'right']], @settings['show_project_progress_overview'])) %>
-- <%= setting_label(:show_recent_projects) %> - <%= check_box_tag('settings[show_recent_projects]', true, @settings['show_recent_projects']) %> -
diff --git a/config/locales/en.yml b/config/locales/en.yml index 0d220c7..4168132 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4,9 +4,9 @@ en: setting_show_project_progress_overview: Show progress on overview page setting_show_project_menu: Show projects' menu setting_show_only_for_my_projects: Show only for my projects - setting_show_recent_projects: Show 'Recently viewed projects' + setting_ignore_hours: Compute progress projects by ignoring hours spent on issues progressive_settings_hint: Defaults settings. Users may override them per session. label_progress: Progress progressive_option_left: Left progressive_option_right: Right - label_recent_projects: Recently viewed projects + label_recent_projects: Recently viewed projects \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ef41b46..08fd217 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1,12 +1,12 @@ fr: setting_show_project_description: Afficher la description des projets setting_show_project_progress: Afficher la progression des projets - setting_show_project_progress_overview: Afficher la progression sur la page d'aperçu + setting_show_project_progress_overview: Afficher le progrès dans la fenêtre d'aperçu setting_show_project_menu: Afficher le menu des projets setting_show_only_for_my_projects: Afficher seulement pour mes projets - setting_show_recent_projects: Afficher 'Projets vus récemment' + setting_ignore_hours: Calculer le progrès du projet en ignorant les heures imputées progressive_settings_hint: Configuration par défaut. Les utilisateurs peuvent la modifier pendant leur session courante. - label_progress: Progression + label_progress: Progrès progressive_option_left: à gauche progressive_option_right: à droite - label_recent_projects: Projets vus récemment + label_recent_projects: Projets vus récemment \ No newline at end of file diff --git a/init.rb b/init.rb index 8761539..9ac346c 100644 --- a/init.rb +++ b/init.rb @@ -6,23 +6,22 @@ name 'Progressive Projects List plugin' author 'Dmitry Babenko' description 'Projects List with menus and progress bars.' - version '3.0.1' + version '1.0.0' url 'http://stgeneral.github.io/redmine-progressive-projects-list/' author_url 'https://github.com/stgeneral' - requires_redmine :version_or_higher => '3.0' + requires_redmine :version_or_higher => '2.1.0' settings :default => { 'show_project_description' => false, 'show_project_progress' => true, 'show_project_menu' => false, 'show_only_for_my_projects' => false, - 'show_recent_projects' => true, - 'show_project_progress_overview' => '' + 'show_project_progress_overview' => '', + 'ignore_hours' => false }, :partial => 'settings/progressive_projects_list' end require 'progressive_projects_list' -require 'progressive/application_helper_patch' require 'progressive/projects_helper_patch' require 'progressive/projects_list_view_listener' require 'progressive/recent_projects_view_listener' diff --git a/lib/progressive/project_decorator.rb b/lib/progressive/project_decorator.rb index 66e1243..798025b 100644 --- a/lib/progressive/project_decorator.rb +++ b/lib/progressive/project_decorator.rb @@ -24,25 +24,35 @@ def issues_progress(open) @issues_progress ||= {} @issues_progress[open] ||= begin progress = 0 - if issues.count > 0 - ratio = open ? 'done_ratio' : 100 + if Setting.plugin_progressive_projects_list['ignore_hours'] + progress = 100 * (issues.count - issues.open.count) / (issues.count) + puts progress + else + if issues.count > 0 + ratio = open ? 'done_ratio' : 100 - done = issues.joins(:status).where("#{IssueStatus.table_name}.is_closed=?",!open) - .sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{estimated_average}) * #{ratio}").to_f - progress = done / (estimated_average * issues.count) + 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 end progress end end - # Cloned from Version#completed_percent + # 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) + if Setting.plugin_progressive_projects_list['ignore_hours'] + issues_progress(true) + else + issues_progress(false) + issues_progress(true) + end end end @@ -50,8 +60,8 @@ def issues_completed_percent def opened_due_date @opened_due_date ||= [ issues.open.maximum('due_date'), - shared_versions.open.maximum('effective_date'), - Issue.open.fixed_version(shared_versions.open).maximum('due_date') + shared_versions.maximum('effective_date'), + Issue.fixed_version(shared_versions).maximum('due_date') ].compact.max end end