File tree 1 file changed +5
-5
lines changed
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')
16
16
* @returns {Array } the search result
17
17
*/
18
18
async 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' ) ) )
24
24
return records
25
25
}
26
26
You can’t perform that action at this time.
0 commit comments