diff --git a/client/package.json b/client/package.json index b4350065..20364cbf 100644 --- a/client/package.json +++ b/client/package.json @@ -2,7 +2,7 @@ "name": "client", "version": "1.0.0", "scripts": { - "start": "node index.js", + "start": "react-scripts start", "client": "yarn start", "clean": "rm -rf node_modules", "dev": "echo \"Please cd into the root directory to run dev \" && exit 1", diff --git a/client/src/Reports/ReportsPage.tsx b/client/src/Reports/ReportsPage.tsx index 14867854..55a7e84b 100644 --- a/client/src/Reports/ReportsPage.tsx +++ b/client/src/Reports/ReportsPage.tsx @@ -353,12 +353,12 @@ function ReportsPage() { setErrorMessage(false); const now = dayjs(); const lastFiscalYrReportData = getReportForDateRange( - dayjs().startOf('year').subtract(1, 'year'), - dayjs().startOf('year'), + dayjs().month(6).startOf('month'), + now, ); const lastCalYrReportData = getReportForDateRange( - dayjs().startOf('year').subtract(1, 'year'), - dayjs().endOf('year').subtract(1, 'year'), + dayjs().startOf('year'), + now, ); const last90DaysReportData = getReportForDateRange( now.subtract(90, 'days'), @@ -454,11 +454,24 @@ function ReportsPage() { return donationDate.isAfter(reportDate.subtract(90, 'days')); } if (alignment === 'last_calendar') { - return donationDate.isAfter(reportDate.subtract(1, 'year')); + return donationDate.isSame(reportDate, 'year'); } + if (alignment === 'last_fiscal') { - return donationDate.isAfter( - reportDate.subtract(1, 'year').startOf('year'), + const fiscalYearStart = + reportDate.month() >= 6 + ? reportDate.startOf('year').month(6).startOf('month') // July 1st of the same year + : reportDate + .startOf('year') + .subtract(1, 'year') + .month(6) + .startOf('month'); // July 1st of the previous year + + const fiscalYearEnd = fiscalYearStart.add(1, 'year'); + + return ( + donationDate.isAfter(fiscalYearStart) && + donationDate.isBefore(fiscalYearEnd) ); } return false; @@ -856,10 +869,10 @@ function ReportsPage() { All Time - Last Fiscal Yr + Current Fiscal Yr - Last Cal Yr + Current Cal Yr Last 90 Days diff --git a/server/src/services/mail.service.ts b/server/src/services/mail.service.ts index 95d0cb8a..2fecdb70 100644 --- a/server/src/services/mail.service.ts +++ b/server/src/services/mail.service.ts @@ -4,10 +4,10 @@ import 'dotenv/config'; import SGmail, { MailDataRequired } from '@sendgrid/mail'; -const appName = 'Boilerplate'; // Replace with a relevant project name +const appName = 'West Park Cultural Donation Management System'; // Replace with a relevant project name const senderName = 'Hack4Impact UPenn'; // Replace with a relevant project sender -const baseUrl = 'http://localhost:3000'; // TODO: figure out better place to put this - +// const baseUrl = 'http://localhost:3000'; // TODO: figure out better place to put this +const baseUrl = 'https://west-park-cultural-0d318cb0ac65.herokuapp.com/'; // eslint-disable-next-line no-useless-concat SGmail.setApiKey(`${process.env.SENDGRID_API_KEY}`); @@ -27,7 +27,7 @@ const emailResetPasswordLink = async (email: string, token: string) => { to: email, subject: 'Link to Reset Password', html: - `

You are receiving this because you (or someone else) have requested ` + + `

You are receiving this because you requested ` + `the reset of your account password for ${appName}. Please visit this ` + `link ` + `within an hour of receiving this email to successfully reset your password

` +