Added a custom card set to vote from 1 -5 and calculate the average when using it.
This commit is contained in:
Родитель
6183d1a060
Коммит
4629c7d90f
|
@ -21,3 +21,4 @@ yarn-debug.log*
|
|||
yarn-error.log*
|
||||
|
||||
*.vsix
|
||||
/.vs
|
||||
|
|
|
@ -56,7 +56,7 @@ export interface ICardComponentProps {
|
|||
|
||||
disabled?: boolean;
|
||||
selected?: boolean;
|
||||
|
||||
confidence?: boolean;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ export class Card extends React.Component<ICardComponentProps> {
|
|||
back,
|
||||
disabled = false,
|
||||
flipped = false,
|
||||
confidence = false,
|
||||
onClick,
|
||||
size = CardSize.medium,
|
||||
selected
|
||||
|
|
|
@ -5,7 +5,8 @@ export interface ICard {
|
|||
|
||||
export enum CardSetType {
|
||||
Numeric,
|
||||
Ordinal
|
||||
Ordinal,
|
||||
NumericWithAverage
|
||||
}
|
||||
|
||||
export interface ICardSet {
|
||||
|
@ -160,4 +161,32 @@ export const defaultCardSets: ICardSet[] = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: "confidence",
|
||||
type: CardSetType.NumericWithAverage,
|
||||
name: "Confidence",
|
||||
cards: [
|
||||
{
|
||||
identifier: "1",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
identifier: "2",
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
identifier: "3",
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
identifier: "4",
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
identifier: "5",
|
||||
value: 5
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
];
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Votes } from "../../../components/votes";
|
|||
import { WorkItemDescription } from "../../../components/workitems/workItemDescription";
|
||||
import { WorkItemEstimate } from "../../../components/workitems/workItemEstimate";
|
||||
import { WorkItemHeader } from "../../../components/workitems/workItemHeader";
|
||||
import { ICard, ICardSet } from "../../../model/cards";
|
||||
import { ICard, ICardSet, CardSetType } from "../../../model/cards";
|
||||
import { IEstimate } from "../../../model/estimate";
|
||||
import { IIdentity } from "../../../model/identity";
|
||||
import { IWorkItem } from "../../../model/workitem";
|
||||
|
@ -31,7 +31,7 @@ interface IWorkItemProps {
|
|||
|
||||
revealed: boolean;
|
||||
canReveal: boolean;
|
||||
|
||||
confidence: boolean;
|
||||
canPerformAdminActions: boolean;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,8 @@ class WorkItemView extends React.Component<IWorkItemProps & typeof Actions> {
|
|||
selectedCardId,
|
||||
estimates,
|
||||
canReveal,
|
||||
revealed
|
||||
revealed,
|
||||
confidence
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
|
@ -142,6 +143,22 @@ class WorkItemView extends React.Component<IWorkItemProps & typeof Actions> {
|
|||
);
|
||||
})}
|
||||
</div>
|
||||
{confidence && (
|
||||
<>
|
||||
<SubTitle>Average</SubTitle>
|
||||
<div className="flex-column flex-self-start">
|
||||
{Math.round((estimates || []).reduce((sum, e) => {
|
||||
const card = cardSet.cards.find(
|
||||
x =>
|
||||
x.identifier ===
|
||||
e.cardIdentifier
|
||||
)!;
|
||||
sum += parseInt((card!.value!.toString() || "0"));
|
||||
return sum;
|
||||
}, 0) / (estimates!.length || 1))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<div>Or enter a custom value:</div>
|
||||
<CustomEstimate
|
||||
commitEstimate={
|
||||
|
@ -232,6 +249,7 @@ export default connect(
|
|||
selectedWorkItem: session.selectedWorkItem!,
|
||||
estimates,
|
||||
revealed: session.revealed,
|
||||
confidence: session.cardSet!.type === CardSetType.NumericWithAverage,
|
||||
canReveal:
|
||||
admin && !session.revealed && estimates && estimates.length > 0,
|
||||
selectedCardId:
|
||||
|
|
Загрузка…
Ссылка в новой задаче