Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/groupselect #1

Closed
wants to merge 112 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
83374e1
Removed unused 'lang' and 'redmine_dnoise_workload' directories
JostBaron Apr 17, 2013
29b5b92
Update show.html.erb
pydubreucq Mar 19, 2013
4df2eeb
Only show current user by default (performance reasons), fix selectio…
JostBaron Apr 19, 2013
470a2df
Made filter form visible again.
JostBaron Apr 20, 2013
94cee3e
Removed temp files from app/views/work_load folder
JostBaron Apr 20, 2013
e7571fc
Made filters work again, show issues for all selected users if checkb…
JostBaron Apr 20, 2013
8653d0c
Changed permission for plugin. Now every logged in user can see the w…
JostBaron Apr 21, 2013
953be86
Fixed some stylings in the legend.
JostBaron Apr 21, 2013
ed1caf0
Added german localization.
JostBaron Apr 21, 2013
2b2faf6
Made german localization not destroy all other labels...
JostBaron Apr 21, 2013
ba0d3e3
Added a bit distance between filter and workload display, removed unu…
JostBaron Apr 21, 2013
1f7b58a
Let the option 'show_issues' default to true, because of the long loa…
JostBaron Apr 21, 2013
d481e49
Switched default user selection for workload plugin back to none, for…
JostBaron Apr 22, 2013
0d353bb
Renamed @usuarios to @usersToDisplay.
JostBaron May 30, 2013
b02e5f0
Renamed @totalDays.
JostBaron May 30, 2013
e577359
Renamed @dias_hasta_el_lunes.
JostBaron May 30, 2013
fa03d65
Renamed '@lunes' to '@monday'. Not sure if thats correct.
JostBaron May 30, 2013
dd1df1f
Renamed '@num_semanas' to '@numberOfWeeks'.
JostBaron May 30, 2013
c18c35d
Renamed '@fecha_actual' to '@currentDay'.
JostBaron May 30, 2013
3b3d863
Renamed class 'ListingUser' to 'ListUser' to fix random occuring error.
JostBaron May 30, 2013
8ff428e
Renamed some methods and variables in dateTools.
JostBaron May 30, 2013
5a66b93
Made tests work and added first test case for date tools.
JostBaron May 30, 2013
3c5f18b
Added the possibility to configure, which days of the week are workin…
JostBaron May 30, 2013
84fe1b7
Added Tests for getRealDistanceInDays and getWorkingDays. Implemented…
JostBaron May 30, 2013
a7284bb
Made the class 'DateTools' consist solely of static functions; Remove…
JostBaron May 30, 2013
433efa3
Removed trailing whitespaces.
JostBaron May 30, 2013
01b6833
Partly cleaned up the view.
JostBaron May 30, 2013
0986bae
Rewrote parts of the view. Not finished yet.
JostBaron May 31, 2013
68f2ad8
Added function that returns all open issues for a list of users in a …
JostBaron Jun 1, 2013
39df063
Rewrote view to use a table for the tabular data.
JostBaron Jun 1, 2013
ecdff22
Rewrote functions to get workload data.
JostBaron Jun 1, 2013
aab3602
Added computation of total workload for each user
JostBaron Jun 2, 2013
eda61a3
Renamed getMonthsIn to getMonthsInTimespan
JostBaron Jun 2, 2013
92d2f6d
Fixed calculation of remaining time for an issue if it has subtasks.
JostBaron Jun 2, 2013
0c31442
Fixed typo in view
JostBaron Jun 2, 2013
bffa4cd
Added tooltip for the issue subject.
JostBaron Jun 2, 2013
0db7b1a
Added settings and calcuations to decide if a workload is low, normal…
JostBaron Jun 2, 2013
b5b4d6a
Removed some debug code
JostBaron Jun 2, 2013
e5c480f
Styled workload-table
JostBaron Jun 2, 2013
a77eb73
Calculation of workload now considers all open issues.
JostBaron Jun 3, 2013
e3486a2
Highlighted overdue issues.
JostBaron Jun 3, 2013
92bf586
Reworked filter form and removed some unused code.
JostBaron Jun 16, 2013
05c7119
Fixed an access to nil when no parameters are given to the plugin.
JostBaron Jun 20, 2013
3f59000
Removed unused stuff: styles, view parts and code.
JostBaron Jun 20, 2013
af89b6f
Rewrote description in init.rb, increased version number.
JostBaron Jun 20, 2013
2b2ae44
Made styles nicer, fixed a bug.
JostBaron Jun 20, 2013
8f429c6
Removed unused assets.
JostBaron Jun 20, 2013
01cc03c
Inserted logo again.
JostBaron Jun 20, 2013
6fe2cf8
Highlighting overdue issues now respects the date set as "today".
JostBaron Jun 20, 2013
0595554
Fixed some bugs in the filter form.
JostBaron Jun 20, 2013
4ac4eea
Corrected styles if no user is shown.
JostBaron Jun 20, 2013
496db54
View respects "show issues" flag.
JostBaron Jun 20, 2013
3c83264
Styled filter form.
JostBaron Jun 20, 2013
f61c192
Improved display of user names in the filters.
JostBaron Jun 20, 2013
22afef5
Corrected setting of default value for num_months.
JostBaron Jun 20, 2013
061b542
Added permissions for viewing the workload - only stubs, nothing is i…
JostBaron Jun 20, 2013
526b803
Removed obsolete manuals.
JostBaron Jun 20, 2013
064a3b6
Updated readme.
JostBaron Jun 21, 2013
a70796d
Updated readme again.
JostBaron Jun 21, 2013
d7eeeb4
Corrected and changed some labels.
JostBaron Jun 21, 2013
d731099
Added basic access right management: There is a new permission
JostBaron Jun 21, 2013
4264ed5
Replaced home-made query for all projects were given permission is
JostBaron Jun 22, 2013
5726a51
Updated comment for function 'calculateTotalUserWorkloads'.
JostBaron Jun 22, 2013
c6a2a41
Added stub and tests for function that removes all issues that are in…
JostBaron Jun 22, 2013
73a97ee
Implemented function to remove invisible issues.
JostBaron Jun 22, 2013
0ddb344
Added summary of workload for invisible issues to the view.
JostBaron Jun 22, 2013
f70ef8e
Updated Readme.
JostBaron Jun 22, 2013
c4221bc
Some styling details, removed debug output.
JostBaron Jun 22, 2013
6b6a2e5
Made some performance improvements.
JostBaron Jun 22, 2013
88392f0
Fixed Readme.
JostBaron Jun 22, 2013
1032870
Small fixes in README
JostBaron Jul 1, 2013
dc33924
Inserted encoding magic comment.
JostBaron Aug 14, 2013
ebed868
Rewrote parts of calculation code so the workload may be displayed per
JostBaron Aug 14, 2013
599bc57
Removed overdue issues from user and project workload summaries, in o…
JostBaron Aug 14, 2013
fba9cd6
Hide workload specifics for user, make them available by clicking.
JostBaron Aug 14, 2013
4fcec60
Removed possibility to show issues, as it is no longer needed. All is…
JostBaron Aug 14, 2013
864399b
Fixed invalid id reference in filters.
JostBaron Aug 14, 2013
23f83a8
Small fix of trigger-icon.
JostBaron Aug 14, 2013
88a8b90
Removed some debug code, added info about overdue issues to output.
JostBaron Aug 14, 2013
59e343a
Small fix of styles.
JostBaron Aug 14, 2013
90b5805
Bugfix: Hours from overdue issues are no longer accumulated in the in…
JostBaron Aug 14, 2013
4008f11
Added tooltip to table header which inform the user about the possibi…
JostBaron Aug 29, 2013
4faa226
Truncate number of hours from overdue issues to two decimals.
JostBaron Aug 29, 2013
e8ccc58
Initially hide summary of invisible issues.
JostBaron Aug 29, 2013
1ddc19c
Update version to 1.0.0, small fix of description.
JostBaron Aug 29, 2013
83dc9ae
Truncated display of hours from overdue issues for projects.
JostBaron Aug 29, 2013
9b5d410
Added italian localization. Thanks to Carlo Troiano for providing it!
JostBaron Aug 29, 2013
1d33660
Increase version to 1.0.1.
JostBaron Aug 29, 2013
5d507e7
[Bugfix] Styles of the date picker are no longer overwritten by plugi…
JostBaron Aug 29, 2013
b4c5e1a
[Bugfix] Regression: Initially hide info about overdue issues.
JostBaron Aug 29, 2013
53017eb
Updated italian localization.
JostBaron Sep 3, 2013
1467984
[Bugfix] Showing workload now works even if user.name contains spaces.
JostBaron Sep 8, 2013
6b40146
Simplified slides.js
CodeInsider Sep 7, 2013
480456a
[Bugfix] Hours from overdue issues are summed if today is no working …
JostBaron Sep 8, 2013
f25b72a
Update work_load_controller.rb
CodeInsider Sep 8, 2013
ec33b31
Merge pull request #12 from CodeInsider/patch-1
JostBaron Sep 8, 2013
7a60b68
[Bugfix] Regression: Truncate number of hours from overdue issues.
JostBaron Sep 9, 2013
55d504c
[Feature, part 1] Implemented calculation to use any day as first day.
JostBaron Sep 9, 2013
5594128
[Feature, part 2] Implemented display to use any day as first day.
JostBaron Sep 9, 2013
b99c308
Updated italian localization. Thanks again to Carlo Traiano.
JostBaron Sep 9, 2013
2983797
[Bugfix] Increased version number to 1.0.2
JostBaron Sep 27, 2013
7c896d8
[Bugfix] Added default settings for the plugin.
JostBaron Sep 27, 2013
d693a74
Change the way plugin settings are accessed.
JostBaron Sep 27, 2013
aadfaf8
Fixing conflict with redmine_tags
davividal Nov 29, 2013
6adcac9
Merge pull request #16 from davividal/conflict_with_redmine_tags
JostBaron Dec 1, 2013
2a2e74f
little change (simplifying)
braini75 Mar 24, 2015
2ff3891
BugFix 'Use as "today"', Fixes #20
braini75 Mar 24, 2015
271b1c0
Add Groupfilters as multiselect, Fixes #9
braini75 Mar 24, 2015
1b472ce
Sort names by lastname, Fixes #8
braini75 Mar 24, 2015
92b8fc0
change some deprecated functions
braini75 Mar 25, 2015
cb475d7
set default width for select boxes
braini75 Mar 25, 2015
5e5481d
Testing
braini75 Apr 7, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
/tmp/test/*
/vendor/rails
*.rbc
/nbproject
57 changes: 49 additions & 8 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,12 +1,53 @@
### D-Noise Workload Redmine Plugin ala FINE
### Workload-Plugin for Redmine

A quick set of mods to the basic Workload plugin, which include
A complete rewrite of the original workload-plugin from Rafael Calleja. The
plugin calculates how much work each user would have to do per day in order
to hit the deadlines for all his issues.

* localized into english (config/locales/en.yml)
* layout modifications
* de-logo-fied (not that we don't like the logos, but we like our pages to look like other Redmine pages)
* default to no users selected when you first land on the page (to reduce load times)
To be able to do this calculation, the issues start date, due date and
estimated time must be filled in. Issues that have not filled in one of
these fields will be shown in the overview, but the workload resulting from
these issues will be ignored.

#### To Do
#### Installation

* Look at implementing Redmine Group selector to view workload by Department/Group
The plugin is tested with redmine 3.0.1.

To install it, simply clone it into the plugins-directory. Execute

git clone https://github.com/JostBaron/redmine_workload.git redmine_workload

in your plugins directory. Then restart your redmine. There is no need for
database migration, as this plugin does not change anything in the database.

#### Configuration

There are two places where this plugin might be configured:

1. In the plugin settings, available in the administration area under "plugins".
2. In the Roles-section of the administration area, the plugin adds a new
permission "view workload data in own projects". When this permission is given
to a user in a project, he might see the workload of all the members of that
project.

#### Permissions

The plugin shows the workload as follows:

* An anonymous user can't see any workload.
* An admin user can see the workload of everyone.
* Any normal user can see the following workload:

- He may always see his own workload.
- He may see the workload of every user that is member of a project for which
he has the permission "view workload data in own projects" (see above).
- When showing the issues that contribute to the workload, only issues visible
to the current user are shown. Invisible issues are only summarized.

#### ToDo

* Make it possible to display the workload starting with another day than the
start of a month.
* Improve performance - requests still take up to 5 seconds.
* Add legend (again).
* Use nicer colors for workload indications.
36 changes: 0 additions & 36 deletions README.rdoc

This file was deleted.

Binary file removed README_workload_english.pdf
Binary file not shown.
Binary file removed README_workload_spanish.pdf
Binary file not shown.
85 changes: 48 additions & 37 deletions app/controllers/work_load_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
class WorkLoadController < ApplicationController

unloadable
Expand All @@ -6,60 +7,70 @@ class WorkLoadController < ApplicationController
helper :issues
helper :projects
helper :queries
helper :workload_filters

include QueriesHelper

before_filter :authorize_global, :except => [:show]
before_filter :authorize_global, :only => [:show]

def show

@fecha_actual = ( !params[:fecha_actual].nil? && params[:fecha_actual].respond_to?(:to_date) ) ? params[:fecha_actual].gsub('/', '-').to_date.strftime("%Y-%m-%d") : DateTime.now.strftime("%Y-%m-%d")
workloadParameters = params[:workload] || {}

if ( params[:month].nil? || params[:months].nil? || params[:year].nil? ) then
params[:month] = DateTime.now.month
params[:months] = 2
params[:year] = DateTime.now.year
end
@first_day = sanitizeDateParameter(workloadParameters[:first_day], Date::today - 10)
@last_day = sanitizeDateParameter(workloadParameters[:last_day], Date::today + 50)
@today = sanitizeDateParameter(workloadParameters[:start_date], Date::today)

params[:show_issues] = ( params[:show_issues].nil? ) ? "0" : params[:show_issues]
# if @today ("select as today") is before @first_day take @today as @first_day
@first_day = [@today, @first_day].min

# Make sure that last_day is at most 12 months after first_day to prevent
# long running times
@last_day = [(@first_day >> 12) - 1, @last_day].min
@timeSpanToDisplay = @first_day..@last_day

@gantt = Redmine::Helpers::Gantt.new(params)
initalizeUsers(workloadParameters)

retrieve_query
@gantt.query = @query if @query.valid?
@issuesForWorkload = ListUser::getOpenIssuesForUsers(@usersToDisplay)
@monthsToRender = ListUser::getMonthsInTimespan(@timeSpanToDisplay)
@workloadData = ListUser::getHoursPerUserIssueAndDay(@issuesForWorkload, @timeSpanToDisplay, @today)
end

@usuarios = (!params[:usuarios_id].nil?) ? User.find_all_by_id(params[:usuarios_id]) : User.active
@utils = ListingUser.new(IssueStatus.find_all_by_is_closed(false, :select => 'id').map(&:id))
@total_days = @utils.tools.distance_of_time_in_days(@gantt.date_from, @gantt.date_to)

@dias_hasta_el_lunes = (( 7 - @gantt.date_from.cwday ) + 1)
@lunes = @gantt.date_from.to_date

@dias_hasta_el_lunes.times do
@lunes = @lunes.next
end
private

def initalizeUsers(workloadParameters)
@groupsToDisplay=Group.all.sort_by { |n| n[:lastname] }

groupIds = workloadParameters[:groups].kind_of?(Array) ? workloadParameters[:groups] : []
groupIds.map! { |x| x.to_i }

# Find selected groups:
@selectedGroups =Group.where(:id => groupIds)

@selectedGroups = @selectedGroups & @groupsToDisplay

@usersToDisplay=ListUser::getUsersOfGroups(@selectedGroups)

# Get list of users that are allowed to be displayed by this user sort by lastname
@usersAllowedToDisplay = ListUser::getUsersAllowedToDisplay().sort_by { |u| u[:lastname] }

@num_semanas = (@total_days / 7).round
userIds = workloadParameters[:users].kind_of?(Array) ? workloadParameters[:users] : []
userIds.map! { |x| x.to_i }

current_date = @gantt.date_from
final_date = @gantt.date_to
@barras_days = []
while ( current_date.to_time < final_date.to_time ) do
@barras_days.push( 16 * @utils.tools.distance_of_time_in_days( @gantt.date_from.to_date.strftime("%Y-%m-%d"), current_date.to_date.end_of_month.strftime("%Y-%m-%d") ) )
current_date = current_date.to_date.end_of_month + 1
end
# Get list of users that should be displayed.
@usersToDisplay += User.where(:id => userIds)

# Intersect the list with the list of users that are allowed to be displayed.
@usersToDisplay = @usersToDisplay & @usersAllowedToDisplay

end


#########
protected
#########
def sanitizeDateParameter(parameter, default)

def is_user_logged_in
if !User.current.logged?
render_403
if (parameter.respond_to?(:to_date)) then
return parameter.to_date
else
return default
end
end

end
14 changes: 0 additions & 14 deletions app/helpers/work_load_helper.rb

This file was deleted.

31 changes: 31 additions & 0 deletions app/helpers/workload_filters_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- encoding : utf-8 -*-
module WorkloadFiltersHelper
def get_option_tags_for_userselection(usersToShow, selectedUsers)

result = '';

usersToShow.each do |user|
selected = selectedUsers.include?(user) ? 'selected="selected"' : ''

result += "<option value=\"#{h(user.id)}\" #{selected}>#{h(user.firstname)} #{h(user.lastname)} (#{h(user.name)})</option>"
end

return result.html_safe
end

def get_option_tags_for_groupselection(groupsToShow, selectedGroups)

result = '';

groupsToShow.each do |group|

selected = selectedGroups.include?(group) ? 'selected="selected"' : ''

result += "<option value=\"#{h(group.id)}\" #{selected}>#{h(group.lastname)}</option>"

end


return result.html_safe
end
end
119 changes: 119 additions & 0 deletions app/views/settings/_workload_settings.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<%
# This file provides configuration options for the workload plugin.
%>

<h2><%= l(:workload_settings_general_workdays) %></h2>

<p><%= l(:workload_settings_general_workdays_explanation) %></p>

<p>
<label><%= l(:workload_settings_general_workdays_monday) %></label>
<input type="hidden"
name="settings[general_workday_monday]"
value=""
>
<input type="checkbox"
name="settings[general_workday_monday]"
value="checked"
<%= "checked" if settings['general_workday_monday'] != '' %>
>
</p>
<p>
<label><%= l(:workload_settings_general_workdays_tuesday) %></label>
<input type="hidden"
name="settings[general_workday_tuesday]"
value=""
>
<input type="checkbox"
name="settings[general_workday_tuesday]"
value="checked"
<%= "checked" if settings['general_workday_tuesday'] != '' %>
>
</p>
<p>
<label><%= l(:workload_settings_general_workdays_wednesday) %></label>
<input type="hidden"
name="settings[general_workday_wednesday]"
value=""
>
<input type="checkbox"
name="settings[general_workday_wednesday]"
value="checked"
<%= "checked" if settings['general_workday_wednesday'] != '' %>
>
</p>
<p>
<label><%= l(:workload_settings_general_workdays_thursday) %></label>
<input type="hidden"
name="settings[general_workday_thursday]"
value=""
>
<input type="checkbox"
name="settings[general_workday_thursday]"
value="checked"
<%= "checked" if settings['general_workday_thursday'] != '' %>
>
</p>
<p>
<label><%= l(:workload_settings_general_workdays_friday) %></label>
<input type="hidden"
name="settings[general_workday_friday]"
value=""
>
<input type="checkbox"
name="settings[general_workday_friday]"
value="checked"
<%= "checked" if settings['general_workday_friday'] != '' %>
>
</p>
<p>
<label><%= l(:workload_settings_general_workdays_saturday) %></label>
<input type="hidden"
name="settings[general_workday_saturday]"
value=""
>
<input type="checkbox"
name="settings[general_workday_saturday]"
value="checked"
<%= "checked" if settings['general_workday_saturday'] != '' %>
>
</p>
<p>
<label><%= l(:workload_settings_general_workdays_sunday) %></label>
<input type="hidden"
name="settings[general_workday_sunday]"
value=""
>
<input type="checkbox"
name="settings[general_workday_sunday]"
value="checked"
<%= "checked" if settings['general_workday_sunday'] != '' %>
>
</p>

<h2><%= l(:workload_settings_hours) %></h2>

<p>
<%= l(:workload_settings_leastdailyworkload) %>
</p>
<p>
<label><%= l(:workload_settings_hours_low_min) %></label>
<input type="text"
name="settings[threshold_lowload_min]"
value="<%= settings['threshold_lowload_min'] %>"
>
</p>
<p>
<label><%= l(:workload_settings_hours_normal_min) %></label>
<input type="text"
name="settings[threshold_normalload_min]"
value="<%= settings['threshold_normalload_min'] %>"
>
</p>
<p>
<label><%= l(:workload_settings_hours_high_min) %></label>
<input type="text"
name="settings[threshold_highload_min]"
value="<%= settings['threshold_highload_min'] %>"
>
</p>
Loading