group status
This commit is contained in:
1 parent
f0e366a73d
commit
b199ce94c1
6 files changed
+25
-13
No files matched your search
+3
-3
@@ -65,13 +65,13 @@ export default function createEvents(log: Log, pg: Pg, discogs, offers) {
|
||||
log.info({ event: Events.ListingsUpdated, bundles: bundles.length });
|
||||
|
||||
for (const bundle of bundles) {
|
||||
log.info({ seller: bundle.seller, items: bundle.items.length }, 'generating offers...');
|
||||
log.debug({ seller: bundle.seller, items: bundle.items.length }, 'generating offers...');
|
||||
const listingIds = bundle.items.map(i => i.id);
|
||||
const updatedOffers = await offers.generate(listingIds, 100, 30)
|
||||
log.info({ offers: updatedOffers.length }, 'offers set');
|
||||
log.debug({ offers: updatedOffers.length }, 'offers set');
|
||||
}
|
||||
|
||||
log.info('offers up to date');
|
||||
log.trace('offers up to date');
|
||||
});
|
||||
|
||||
events.on(Events.Connection, async function onConnection({ ws, id }) {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ function sortOffers(o) {
|
||||
|
||||
export default function createOffers(log: Log, pg: Pg) {
|
||||
async function generate(listingIds: DiscogsListing[], bulkShipping: number, baseShipping: number) {
|
||||
log.info('generateOffers', { listingIds, bulkShipping, baseShipping });
|
||||
log.debug('generateOffers', { listingIds, bulkShipping, baseShipping });
|
||||
const listings = await pg.listingByIds(listingIds);
|
||||
|
||||
// log.info({ listings }, 'creating offers for listings')
|
||||
|
||||
+4
-3
@@ -59,9 +59,10 @@ export default function createPg(log: Log, prisma: PrismaClient): Pg {
|
||||
include: {
|
||||
want: true,
|
||||
},
|
||||
orderBy: {
|
||||
total: 'asc',
|
||||
},
|
||||
orderBy: [
|
||||
{ total: 'asc' },
|
||||
{ listingId: 'asc' },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user