fix task and mail
This commit is contained in:
parent
5fea257b68
commit
41a3baddd8
|
|
@ -102,11 +102,18 @@ export class MailsService {
|
|||
});
|
||||
|
||||
// Separate hot and non-hot items, preserving original order
|
||||
const hotItemsFirst = [
|
||||
...decorated.filter((p) => p.isHotItem),
|
||||
...decorated.filter((p) => !p.isHotItem),
|
||||
const hotItemsList = decorated.filter((p) => p.isHotItem);
|
||||
const nonHotItems = decorated.filter((p) => !p.isHotItem);
|
||||
|
||||
// Đưa các item mới (isNew) lên đầu trong nhóm không phải hot item
|
||||
const sortedNonHotItems = [
|
||||
...nonHotItems.filter((p) => p.isNew),
|
||||
...nonHotItems.filter((p) => !p.isNew),
|
||||
];
|
||||
|
||||
// Separate hot and non-hot items, preserving original order
|
||||
const hotItemsFirst = [...hotItemsList, ...sortedNonHotItems];
|
||||
|
||||
const rows = hotItemsFirst
|
||||
.map((p) => {
|
||||
const isHotItem = isHotItemFn(p, hotItems);
|
||||
|
|
@ -125,7 +132,7 @@ export class MailsService {
|
|||
|
||||
return `
|
||||
<tr ${isHotItem ? 'style="background-color: #ff848496;margin-bottom: 4px;"' : 'margin-bottom: 4px;'}>
|
||||
<td style="display:flex;max-width: 60px;"><img src="${p.image_url}" alt="Product Image" style="height: 60px !important; object-fit: contain; border-radius: 4px;" /></td>
|
||||
<td style="display:flex;max-width: 60px;"><img src="${p.image_url}" alt="Product Image" style="height: 60px !important;width:60px !important; object-fit: contain; border-radius: 4px;" /></td>
|
||||
<td style="${nameStyle}">${namePrefix}${p.name}</td>
|
||||
<td style="font-weight: bold; color: #e03131;">${p.current_price ? '$' + p.current_price : 'None'}</td>
|
||||
<td><a href="${p.url}" target="_blank" style="color: #007bff;">View</a></td>
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export class TasksService {
|
|||
updated_at: Between(startOfDay, endOfDay),
|
||||
},
|
||||
relations: { scrap_config: { web_bid: true } },
|
||||
order: { updated_at: 'ASC' },
|
||||
order: { updated_at: 'DESC' },
|
||||
});
|
||||
|
||||
const hotItems = await this.hotItemApi.listHotItem();
|
||||
|
|
@ -95,7 +95,7 @@ export class TasksService {
|
|||
}
|
||||
}
|
||||
|
||||
// @Cron('59 5 * * *')
|
||||
@Cron('59 5 * * *')
|
||||
// @Cron(CronExpression.EVERY_MINUTE)
|
||||
async handleScraps() {
|
||||
const processName = 'scrape-data-keyword';
|
||||
|
|
|
|||
Loading…
Reference in New Issue