Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion backend/src/modules/organization/services/crons.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ export class OrganizationCronsService {

@Cron('0 5 1 1 *') // 1st of January, 5:00 AM
async generateFinancialDataAndReportsForPreviousYear() {
const lastYear = new Date().getFullYear() - 1;
const thisYear = new Date().getFullYear();
const lastYear = thisYear - 1;

// 1. Get all organizations with are missing the previous year the financial data and reports
const organizations = await this.organizationRepository.getMany({
where: {
organizationGeneral: {
yearCreated: Not(thisYear),
},
},
relations: {
organizationFinancial: true,
organizationGeneral: true,
Expand Down