Skip to content

Commit d2627b6

Browse files
author
Sachin Maheshwari
committed
DBtoES migration: to avoid community-app UI broken in case of empty array
1 parent 6b78e92 commit d2627b6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/migrateFromDBToES.js

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ co(function * () {
8787
yield migrateRecords('Submission', t => {
8888
t.review = _.map(_.filter(reviews, ['submissionId', t.id]), r => _.omit(r, ['resource']))
8989
t.reviewSummation = _.map(_.filter(reviewSummations, ['submissionId', t.id]), r => _.omit(r, ['resource']))
90+
if (_.isEmpty(t.review)) {
91+
t = _.omit(t, ['review'])
92+
}
93+
if (_.isEmpty(t.reviewSummation)) {
94+
t = _.omit(t, ['reviewSummation'])
95+
}
9096
return t
9197
})
9298
}).catch((err) => {

0 commit comments

Comments
 (0)