Project

General

Profile

Defect #1153

Calendar partial : Sprint begin/end month icon on wrong month

Added by Redmine Smile over 5 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Category:
Calendar
Target version:
Source:
Customer
Detected on version:
Blocked:
No
Alone:
No
Milestones:
Sprint:

Description

Hi,

First, thanks for your marvelous plugin. We are testing it at Smile to see if we can use it on all our Agile projects.

The issue : if a Sprint begin / end day (for example the 3rd of april 2016) is a day that is present twice on the calendar view (that displays full weeks) the first picked can be the wrong one :

Can you take a look at it ?

Thanks by advance.


Files


Subtasks

To do #1170: Adapt provided patchResolvedEmilio González MontañaActions
#1

Updated by Redmine Smile over 5 years ago

Here is a solution that checks that the icon is on the right week :

  • scrum_hooks/_sprints.html.erb
      function AddSprintToDay(sprintName, sprintUrl, day, week, start)
      {
        var cellElement = null;
        var cellElementWeekNumber = 0;
        var dayOneFound = false;
        var elements = document.getElementsByTagName("*");
        for (var i = 0; (cellElement == null) && (i < elements.length); i++)
        {
          if (elements[i].className == "day-num")
          {
            var oneDay = parseInt(elements[i].childNodes[0].nodeValue);
            if ((!dayOneFound) && (oneDay == 1))
            {
              dayOneFound = true;
            }
            if (dayOneFound && (oneDay == day))
            {
              cellElement = elements[i].parentNode;
              cellParentTR = cellElement.parentNode;
              if (cellParentTR != null) {
                cellParentTRFirstTD = cellParentTR.childNodes[1];
                if (cellParentTRFirstTD != null) {
                  cellElementWeekNumber = parseInt(cellParentTRFirstTD.innerText);
    
                }
                if (cellElementWeekNumber != 0 && (cellElementWeekNumber == week)) {
                  cellElement = elements[i].parentNode;
                } else {
                  cellElement = null;
                }
              }
            }
          }
        }
    
  • calendars_controller_patch.rb
    
            def query_sprints(sprints, query, calendar, start)
              date_field = start ? 'sprint_start_date' : 'sprint_end_date'
              query.sprints.where(date_field => calendar.startdt..calendar.enddt,
                                  is_product_backlog: false).each do |sprint|
                sprints << {:name => sprint.name,
                            :url => url_for(:controller => :sprints,
                                            :action => :show,
                                            :id => sprint.id),
                            :day => sprint.send(date_field).day,
                            :week => sprint.send(date_field).cweek,
                            :start => start}
              end
            end
    
#2

Updated by Emilio González Montaña about 5 years ago

  • Status changed from New to In progress
  • Target version set to Scrum v0.14.0
  • Sprint set to Sprint 28
#3

Updated by Emilio González Montaña about 5 years ago

  • Status changed from In progress to Resolved

Thanks for the patch Ennder!

#4

Updated by Redmine Smile about 5 years ago

Thanks a lot to have merged the patch !

Also available in: Atom PDF