Skip to content

Commit

Permalink
Merge pull request #757 from unitaryfund/747_no_top_level_task_keys
Browse files Browse the repository at this point in the history
#747: No top level task keys in modal
  • Loading branch information
WrathfulSpatula authored Dec 12, 2022
2 parents d1a9e4a + bd2490d commit 6e34559
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/SubmissionRefsAddModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const SubmissionRefsAddModal = (props) => {
/><br />
<FormFieldTypeaheadRow
inputName={`parent${props.modalMode}`}
label={`Parent ${key}` + (props.modalMode === 'Task' ? '(required)' : '<br/>(if any)')} labelKey='name'
label={`Parent ${key}` + (props.modalMode === 'Task' ? '' : '<br/>(if any)')} labelKey='name'
options={props.allNames}
onSelect={handleOnSelectParent}
onChange={handleOnChangeParent}
Expand Down
11 changes: 11 additions & 0 deletions src/views/Submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class Submission extends React.Component {
this.handleOnChange = this.handleOnChange.bind(this)
this.handleSortNames = this.handleSortNames.bind(this)
this.handleTrimTasks = this.handleTrimTasks.bind(this)
this.handleTrimParentTasks = this.handleTrimParentTasks.bind(this)
this.handleTrimMethods = this.handleTrimMethods.bind(this)
this.handleTrimPlatforms = this.handleTrimPlatforms.bind(this)
this.handleTrimTags = this.handleTrimTags.bind(this)
Expand Down Expand Up @@ -398,6 +399,7 @@ class Submission extends React.Component {
}

handleTrimTasks (submission, tasks) {
this.handleTrimParentTasks(tasks)
for (let i = 0; i < submission.tasks.length; i++) {
for (let j = 0; j < tasks.length; j++) {
if (submission.tasks[i].id === tasks[j].id) {
Expand All @@ -408,6 +410,15 @@ class Submission extends React.Component {
}
}

handleTrimParentTasks (tasks) {
for (let j = 0; j < tasks.length; j++) {
if (tasks[j].top) {
tasks.splice(j, 1)
--j
}
}
}

handleTrimMethods (submission, methods) {
for (let i = 0; i < submission.methods.length; i++) {
for (let j = 0; j < methods.length; j++) {
Expand Down

0 comments on commit 6e34559

Please sign in to comment.