issue 3074 - the new sprint date starts at the end of the last open sprint
parent
23fc1372d3
commit
ec04907d44
|
@ -105,6 +105,15 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading,
|
|||
$confirm.notify("error")
|
||||
$repo.remove($scope.sprint).then(onSuccess, onError)
|
||||
|
||||
getLastSprint = ->
|
||||
openSprints = _.filter $scope.sprints, (sprint) ->
|
||||
return !sprint.closed
|
||||
|
||||
sortedSprints = _.sortBy openSprints, (sprint) ->
|
||||
return moment(sprint.estimated_finish, 'YYYY-MM-DD').format('X')
|
||||
|
||||
return sortedSprints[sortedSprints.length - 1]
|
||||
|
||||
$scope.$on "sprintform:create", (event, projectId) ->
|
||||
form = $el.find("form").checksley()
|
||||
form.reset()
|
||||
|
@ -115,20 +124,24 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading,
|
|||
$scope.sprint.name = null
|
||||
$scope.sprint.slug = null
|
||||
|
||||
lastSprint = $scope.sprints[0]
|
||||
lastSprint = getLastSprint()
|
||||
|
||||
estimatedStart = moment()
|
||||
if $scope.sprint.estimated_start
|
||||
estimatedStart = moment($scope.sprint.estimated_start)
|
||||
else if lastSprint?
|
||||
|
||||
if lastSprint
|
||||
estimatedStart = moment(lastSprint.estimated_finish)
|
||||
else if $scope.sprint.estimated_start
|
||||
estimatedStart = moment($scope.sprint.estimated_start)
|
||||
|
||||
$scope.sprint.estimated_start = estimatedStart.format(prettyDate)
|
||||
|
||||
estimatedFinish = moment().add(2, "weeks")
|
||||
if $scope.sprint.estimated_finish
|
||||
estimatedFinish = moment($scope.sprint.estimated_finish)
|
||||
else if lastSprint?
|
||||
|
||||
if lastSprint
|
||||
estimatedFinish = moment(lastSprint.estimated_finish).add(2, "weeks")
|
||||
else if $scope.sprint.estimated_finish
|
||||
estimatedFinish = moment($scope.sprint.estimated_finish)
|
||||
|
||||
$scope.sprint.estimated_finish = estimatedFinish.format(prettyDate)
|
||||
|
||||
lastSprintNameDom = $el.find(".last-sprint-name")
|
||||
|
|
Loading…
Reference in New Issue