-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Beta: split backlog stories on sprints/iterations (#376)
* add .ruby-version to gitignore * refactored constants * divide stories by sprint and create fillers between overflown stories * put stories with no points on the last real sprint * refactored conditionals and overflow handling * fix filler sprints count * add basic tests to sprint, sprints and iteration. * adjust sprints to project story delivery instead of start. * refactor for sprints/iterations - replaced index for sprint.number on sprints.js - replaced string for constant on story.js - replaced potential global on iterations_spec * add feature to collapse sprints * - adds story to sprint when still have space - fix: sprints start in 1 * apply requested changes
- Loading branch information
1 parent
1a76fdb
commit 365e970
Showing
17 changed files
with
736 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ db/*.sqlite3 | |
*.log | ||
tmp/ | ||
.rvmrc | ||
.ruby-version | ||
.sass-cache/ | ||
*.DS_Store | ||
config/deploy.rb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,42 @@ | ||
import actionTypes from './actionTypes'; | ||
import * as iteration from '../models/beta/iteration'; | ||
import actionTypes from "./actionTypes"; | ||
import * as iteration from "../models/beta/iteration"; | ||
|
||
const setStoryChillyBin = (payload) => ({ | ||
const setStoryChillyBin = payload => ({ | ||
type: actionTypes.COLUMN_CHILLY_BIN, | ||
data: payload, | ||
data: payload | ||
}); | ||
|
||
const setStoryBacklog = (payload) => ({ | ||
const setStoryBacklog = payload => ({ | ||
type: actionTypes.COLUMN_BACKLOG, | ||
data: payload, | ||
data: payload | ||
}); | ||
|
||
const setStoryDone = (payload) => ({ | ||
const setStoryDone = payload => ({ | ||
type: actionTypes.COLUMN_DONE, | ||
data: payload, | ||
data: payload | ||
}); | ||
|
||
export const getColumnType = (story, project) => { | ||
if(story.state === 'unscheduled') { | ||
if (story.state === "unscheduled") { | ||
return setStoryChillyBin(story); | ||
} | ||
if(isBacklog(story, project)) { | ||
if (isBacklog(story, project)) { | ||
return setStoryBacklog(story); | ||
} | ||
return setStoryDone(story); | ||
} | ||
}; | ||
|
||
const setColumn = (dispatch, project) => story => { | ||
var type = getColumnType(story, project); | ||
return dispatch(type); | ||
} | ||
}; | ||
|
||
const isBacklog = (story, project) => { | ||
const currentIteration = iteration.getCurrentIteration(project); | ||
const storyIteration = iteration.getIterationForStory(story, project); | ||
const isFromCurrentSprint = currentIteration === storyIteration; | ||
return story.state !== 'accepted' || isFromCurrentSprint; | ||
} | ||
return story.state !== "accepted" || isFromCurrentSprint; | ||
}; | ||
|
||
export const classifyStories = (dispatch, stories, project) => stories.map(setColumn(dispatch, project)) | ||
export const classifyStories = (dispatch, stories, project) => | ||
stories.map(setColumn(dispatch, project)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import React from 'react' | ||
import Stories from '../stories/Stories'; | ||
import React from "react"; | ||
import Stories from "../stories/Stories"; | ||
|
||
const Column = ({ title, stories }) => ( | ||
const Column = ({ title, children }) => ( | ||
<div className="Column"> | ||
<div className="Column__header"> | ||
<h3 className="Column__name">{title}</h3> | ||
<button type="button" className="Column__btn-close">x</button> | ||
<button type="button" className="Column__btn-close"> | ||
x | ||
</button> | ||
</div> | ||
<Stories stories={stories} /> | ||
<div className="Column__body">{children}</div> | ||
</div> | ||
); | ||
|
||
export default Column | ||
export default Column; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import Stories from "./Stories"; | ||
|
||
const propTypes = { | ||
number: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
startDate: PropTypes.node, | ||
points: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
completedPoints: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
stories: PropTypes.array | ||
}; | ||
|
||
const defaultProps = { | ||
number: 0, | ||
startDate: 0, | ||
points: 0, | ||
stories: [] | ||
}; | ||
|
||
class Sprint extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { isClosed: false }; | ||
this.toggleSprint = this.toggleSprint.bind(this); | ||
} | ||
|
||
toggleSprint() { | ||
this.setState(prevState => ({ isClosed: !prevState.isClosed })); | ||
} | ||
|
||
render() { | ||
const { number, startDate, points, completedPoints, stories } = this.props; | ||
const closedStyle = this.state.isClosed && "Sprint__body--is-collapsed"; | ||
return ( | ||
<div className="Sprint"> | ||
<div className="Sprint__header" onClick={this.toggleSprint}> | ||
{number} - {startDate} | ||
<span className="Sprint__points"> | ||
{completedPoints > 0 && `${completedPoints} / `} | ||
{points} | ||
</span> | ||
</div> | ||
<div className={`Sprint__body ${closedStyle}`}> | ||
{stories && <Stories stories={stories} />} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
Sprint.propTypes = propTypes; | ||
Sprint.defaultProps = defaultProps; | ||
|
||
export default Sprint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import Sprint from "./Sprint"; | ||
import * as Iteration from "models/beta/iteration"; | ||
|
||
const propTypes = { | ||
stories: PropTypes.array, | ||
project: PropTypes.object | ||
}; | ||
|
||
const defaultProps = { | ||
stories: [], | ||
project: {} | ||
}; | ||
|
||
const renderSprints = sprints => { | ||
return sprints.map( | ||
(sprint, index) => | ||
sprint ? ( | ||
<Sprint | ||
key={sprint.number} | ||
number={sprint.number} | ||
startDate={sprint.startDate} | ||
stories={sprint.stories} | ||
points={sprint.points} | ||
completedPoints={sprint.completedPoints} | ||
/> | ||
) : null | ||
); | ||
}; | ||
|
||
const Sprints = ({ stories, project }) => { | ||
const currentSprintNumber = Iteration.getCurrentIteration(project) || 0; | ||
const sprints = Iteration.groupBySprints( | ||
stories, | ||
project, | ||
currentSprintNumber | ||
); | ||
|
||
if (!stories.length) return null; | ||
|
||
return <div className="Sprints">{renderSprints(sprints)}</div>; | ||
}; | ||
|
||
Sprint.propTypes = propTypes; | ||
Sprint.defaultProps = defaultProps; | ||
|
||
export default Sprints; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const status = { | ||
ACCEPTED: "accepted", | ||
DELIVERED: "delivered", | ||
STARTED: "started", | ||
REJECTED: "rejected", | ||
FINISHED: "finished", | ||
UNSTARTED: "unstarted" | ||
}; | ||
|
||
export const storyTypes = { | ||
BUG: "bug", | ||
CHORE: "chore", | ||
FEATURE: "feature", | ||
RELEASE: "release" | ||
}; |
Oops, something went wrong.