Skip to content

Commit

Permalink
chore(congregations): fixing some code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Dec 14, 2024
1 parent 3f42d3d commit fc05294
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,20 @@ const useImportCPE = () => {
const splitDateObj = new Date(splitDate);

validStatus.forEach((dateRange) => {
const startDate = new Date(dateRange.start);
const endDate = dateRange.end
? new Date(dateRange.end)
const startDate = new Date(dateRange.start_date);
const endDate = dateRange.end_date
? new Date(dateRange.end_date)
: splitDateObj;

if (splitDateObj > startDate && splitDateObj <= endDate) {
unbaptizedStatus.push({
start: dateRange.start,
end: formatDate(prevDate, 'yyyy/MM/dd'),
start_date: dateRange.start_date,
end_date: formatDate(prevDate, 'yyyy/MM/dd'),
});
baptizedStatus.push({
start_date: splitDate,
end_date: dateRange.end_date,
});
baptizedStatus.push({ start: splitDate, end: dateRange.end });
} else if (startDate >= splitDateObj) {
baptizedStatus.push(dateRange);
} else {
Expand Down Expand Up @@ -248,6 +251,10 @@ const useImportCPE = () => {
value: oldPerson.phone,
updatedAt: new Date().toISOString(),
},
first_report: {
value: firstReport,
updatedAt: new Date().toISOString(),
},
publisher_baptized: {
active: {
value: oldPerson.isBaptized,
Expand Down Expand Up @@ -651,7 +658,7 @@ const useImportCPE = () => {

if (!isMonday) continue;

if (!record.mwb_week_date_locale) return;
if (!record.mwb_week_date_locale) continue;

const obj = structuredClone(sourceSchema);

Expand Down

0 comments on commit fc05294

Please sign in to comment.