Skip to content

Commit

Permalink
fixed bugs for card #132 (outcmoe indexing and format validation) - MR
Browse files Browse the repository at this point in the history
  • Loading branch information
marungo committed Mar 21, 2018
1 parent d901ee7 commit 27adf79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions app/components/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ export default class Branch extends React.Component {
this.props.onChange(this.props.emotion, "enabled", !this.props.value.enabled);
}

getOtherLevelIndices() {
return Array(this.props.numLevels+1).fill()
.map((_, i) => i === 0 ? "Credits" : "Level " + i)
.filter((_,index) => index !== Number(this.props.parentIndex));
populateOutcomeList() {
return Array(this.props.numLevels+1).fill().map((_, i) => i === 0 ? "Credits" : "Level " + i);
}

branch() {
const otherLevelIndices = this.getOtherLevelIndices();
const outcomePossibilities = this.populateOutcomeList();
const branch = this.props.value;

if (branch.enabled) {
return (
<div>
&nbsp;Outcome:&nbsp;
<select name="outcome" id="outcome" value={branch.outcome} onChange={this.handleBranchInputChange}>
{ otherLevelIndices.map((outcome,i) => <option value={i}>{outcome}</option>) }
{ outcomePossibilities.map((outcome,i) =>
i !== Number(this.props.parentIndex) ? <option value={i}>{outcome}</option> : null )}
</select>
<TimeRange name="range" range={[branch.start, branch.end]}
onChange={this.handleTimeRangeChange} numFrames={this.props.numFrames}/>
Expand Down
2 changes: 1 addition & 1 deletion app/utilities/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const isValid = (value, numFrames) => {
}

const validFormat = (value) => {
const regex = /^[0-9]{2,2}:[0-9]{2,2}.[0-9]{2,2}/;
const regex = /^[0-9]{2,2}:[0-9]{2,2}\.[0-9]{2,2}/;
return regex.test(value);
}

Expand Down

0 comments on commit 27adf79

Please sign in to comment.