From 31929efc5baf687ebbeb590bd08195f87ba7cd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Thu, 27 Jan 2022 18:01:31 +0000 Subject: [PATCH] refactor: clean up some names --- lib/customers.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/customers.js b/lib/customers.js index 09e7d031..c6881691 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -756,13 +756,12 @@ function selectLatestData (customerData, customerEditedData) { 'name' ] _.map(field => { - let fieldName = field - if (_.includes(field, ['front_camera', 'id_card_photo'])) fieldName = fieldName + '_path' const atField = field + '_at' const byField = field + '_by' - if (!_.has(fieldName, customerData) || !_.has(fieldName, customerEditedData)) return + if (_.includes(field, ['front_camera', 'id_card_photo'])) field = field + '_path' + if (!_.has(field, customerData) || !_.has(field, customerEditedData)) return if (customerData[atField] < customerEditedData[atField]) { - customerData[fieldName] = customerEditedData[fieldName] + customerData[field] = customerEditedData[field] customerData[atField] = customerEditedData[atField] customerData[byField] = customerEditedData[byField] }