File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
src/components/ChallengeEditor Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -639,15 +639,24 @@ class ChallengeEditor extends Component {
639
639
return false
640
640
}
641
641
642
- return ! ( Object . values ( pick ( [
642
+ const requiredFields = [
643
643
'trackId' ,
644
644
'typeId' ,
645
645
'name' ,
646
646
'description' ,
647
647
'tags' ,
648
648
'prizeSets'
649
- ] , challenge ) ) . filter ( v => ! v . length ) . length ||
650
- _ . isEmpty ( this . state . currentTemplate ) )
649
+ ]
650
+ let isRequiredMissing = false
651
+
652
+ requiredFields . forEach ( ( key ) => {
653
+ const value = challenge [ key ]
654
+
655
+ // this check works for string and array values
656
+ isRequiredMissing = isRequiredMissing || ! value || ! value . length
657
+ } )
658
+
659
+ return ! ( isRequiredMissing || _ . isEmpty ( this . state . currentTemplate ) )
651
660
}
652
661
653
662
validateChallenge ( ) {
You can’t perform that action at this time.
0 commit comments