Skip to content

Commit

Permalink
fix bug for multimedia annotation error flag not being set
Browse files Browse the repository at this point in the history
  • Loading branch information
trashmai committed Nov 26, 2018
1 parent 8920204 commit 321e6a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cognito-s3-control/lambda/lambda_csv_to_json/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ exports.handler = (event, context, callback) => {
let force_import_validated = true;
// 每筆 record 對應到一個 token,但單一多媒體檔也可能同時有多個 tokens,因此要用 unique id 為 group
records.forEach(function (record, record_idx) {

let multimedia_error_flag = false;

if (!((!unmatched_metadata_exists || force_import_validated) && !missing_required)) {
return;
Expand Down Expand Up @@ -366,6 +368,7 @@ exports.handler = (event, context, callback) => {
if (validators[k] && validators[k].indexOf(record[k]) < 0) {
data_error_flag = true;
token_error_flag = true;
multimedia_error_flag = true;
}
}

Expand Down Expand Up @@ -415,6 +418,7 @@ exports.handler = (event, context, callback) => {
mma[_id].$set.day = day;
mma[_id].$set.hour = hour;
mma[_id].$set.imageUrlPrefix = 'https://s3-ap-northeast-1.amazonaws.com/camera-trap/';
mma[_id].$set.multimedia_error_flag = mma[_id].$set.multimedia_error_flag || multimedia_error_flag;

// set on insert (upsert)
mma[_id].$setOnInsert = {
Expand Down

0 comments on commit 321e6a1

Please sign in to comment.