Merge pull request #587 from taigaio/issue/3074/new-sprint-date
issue 3074 - the new sprint date starts at the end of the last open s…stable
commit
de26b64659
|
@ -105,6 +105,15 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading,
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
$repo.remove($scope.sprint).then(onSuccess, onError)
|
$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) ->
|
$scope.$on "sprintform:create", (event, projectId) ->
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
form.reset()
|
form.reset()
|
||||||
|
@ -115,20 +124,24 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading,
|
||||||
$scope.sprint.name = null
|
$scope.sprint.name = null
|
||||||
$scope.sprint.slug = null
|
$scope.sprint.slug = null
|
||||||
|
|
||||||
lastSprint = $scope.sprints[0]
|
lastSprint = getLastSprint()
|
||||||
|
|
||||||
estimatedStart = moment()
|
estimatedStart = moment()
|
||||||
if $scope.sprint.estimated_start
|
|
||||||
estimatedStart = moment($scope.sprint.estimated_start)
|
if lastSprint
|
||||||
else if lastSprint?
|
|
||||||
estimatedStart = moment(lastSprint.estimated_finish)
|
estimatedStart = moment(lastSprint.estimated_finish)
|
||||||
|
else if $scope.sprint.estimated_start
|
||||||
|
estimatedStart = moment($scope.sprint.estimated_start)
|
||||||
|
|
||||||
$scope.sprint.estimated_start = estimatedStart.format(prettyDate)
|
$scope.sprint.estimated_start = estimatedStart.format(prettyDate)
|
||||||
|
|
||||||
estimatedFinish = moment().add(2, "weeks")
|
estimatedFinish = moment().add(2, "weeks")
|
||||||
if $scope.sprint.estimated_finish
|
|
||||||
estimatedFinish = moment($scope.sprint.estimated_finish)
|
if lastSprint
|
||||||
else if lastSprint?
|
|
||||||
estimatedFinish = moment(lastSprint.estimated_finish).add(2, "weeks")
|
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)
|
$scope.sprint.estimated_finish = estimatedFinish.format(prettyDate)
|
||||||
|
|
||||||
lastSprintNameDom = $el.find(".last-sprint-name")
|
lastSprintNameDom = $el.find(".last-sprint-name")
|
||||||
|
|
Loading…
Reference in New Issue