Skip to content

Commit

Permalink
arrivals bigger range
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Oct 27, 2024
1 parent a0be8c3 commit 368484d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/features/ngo/ngo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class NgoService {

async getNgoArrivals(socialWorker: number, swIds: number[]) {
const today = new Date();
const daysAgo = today.setDate(today.getDate() - 90);
const daysAgo = today.setDate(today.getDate() - 30);

const needs = await this.needFlaskRepository
.createQueryBuilder('need')
Expand All @@ -73,16 +73,16 @@ export class NgoService {
'child.id = need.child_id',
)
.leftJoinAndMapOne('child.ngo', NGO, 'ngo', 'ngo.id = child.id_ngo')
.where(
new Brackets((qb) => {
qb.where('need.type = :typeProduct', {
typeProduct: NeedTypeEnum.PRODUCT,
}).andWhere('need.status = :productStatus', {
productStatus: ProductStatusEnum.PURCHASED_PRODUCT,
});
}),
)
.andWhere('child.isConfirmed = :childConfirmed', { childConfirmed: true })
// .where(
// new Brackets((qb) => {
// qb.where('need.type = :typeProduct', {
// typeProduct: NeedTypeEnum.PRODUCT,
// }).andWhere('need.status = :productStatus', {
// productStatus: ProductStatusEnum.PURCHASED_PRODUCT,
// });
// }),
// )
.where('child.isConfirmed = :childConfirmed', { childConfirmed: true })
.andWhere('need.isConfirmed = :needConfirmed', { needConfirmed: true })
.andWhere('need.expected_delivery_date > :startDate', {
startDate: new Date(daysAgo),
Expand Down

0 comments on commit 368484d

Please sign in to comment.