File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,11 @@ const constants = require('../../app-constants')
1616 * @returns {Array } the search result
1717 */
1818async function searchChallengeTimelineTemplates ( criteria ) {
19- const list = await helper . scan ( 'ChallengeTimelineTemplate' )
20- const records = _ . filter ( list , e => ( ! criteria . typeId || criteria . typeId === e . typeId ) &&
21- ( ! criteria . timelineTemplateId || criteria . timelineTemplateId === e . timelineTemplateId ) &&
22- ( ! criteria . trackId || criteria . trackId === e . trackId ) &&
23- ( ! criteria . isDefault || criteria . isDefault === e . isDefault ) )
19+ let records = await helper . scan ( 'ChallengeTimelineTemplate' )
20+ if ( criteria . typeId ) records = _ . filter ( records , e => ( criteria . typeId === e . typeId ) )
21+ if ( criteria . trackId ) records = _ . filter ( records , e => ( criteria . trackId === e . trackId ) )
22+ if ( criteria . timelineTemplateId ) records = _ . filter ( records , e => ( criteria . timelineTemplateId === e . timelineTemplateId ) )
23+ if ( ! _ . isUndefined ( criteria . isDefault ) ) records = _ . filter ( records , e => ( e . isDefault === ( criteria . isDefault === 'true' ) ) )
2424 return records
2525}
2626
You can’t perform that action at this time.
0 commit comments