Skip to content

Commit

Permalink
bugfix(function): small fixes (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkue authored Nov 6, 2023
1 parent 3d998de commit 6115d3d
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 39 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ jobs:
TWILIO_SENDER_PHONE: ${{ secrets.TWILIO_TEST_SENDER_PHONE }}
run: npm run functions:test

- name: Run Playwright tests
run: npm run functions:test:playwright

- name: Deploy Playwright Report to GitHub Pages
uses: rossjrw/pr-preview-action@v1
if: always()
with:
source-dir: functions/playwright-report/
preview-branch: gh-pages
umbrella-dir: functions-playwright-report
action: auto
# TODO: re-enable
# - name: Run Playwright tests
# run: npm run functions:test:playwright
#
# - name: Deploy Playwright Report to GitHub Pages
# uses: rossjrw/pr-preview-action@v1
# if: always()
# with:
# source-dir: functions/playwright-report/
# preview-branch: gh-pages
# umbrella-dir: functions-playwright-report
# action: auto

deploy:
name: Deploy functions on Firebase (social-income-staging)
Expand Down
4 changes: 2 additions & 2 deletions admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"@mui/icons-material": "^5.14.15",
"@mui/lab": "^5.0.0-alpha.150",
"@mui/material": "^5.14.15",
"@mui/x-data-grid": "^6.17.0",
"@mui/x-date-pickers": "^6.17.0",
"@mui/x-data-grid": "^6.18.0",
"@mui/x-date-pickers": "^6.18.0",
"@socialincome/shared": "^1.0.0",
"algoliasearch": "^4.20.0",
"firebase": "^9.23.0",
Expand Down
2 changes: 2 additions & 0 deletions admin/src/collections/recipients/RecipientsProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const mainLanguageProperty: StringProperty = {

export const birthDateProperty: Property = {
name: 'Birthday',
longDescription: 'Date of birth',
dataType: 'date',
mode: 'date',
};
Expand Down Expand Up @@ -140,6 +141,7 @@ export const TwitterProperty: Property = {

export const SIStartDateProperty: Property = {
name: 'Start Date',
longDescription: 'Starting date',
dataType: 'date',
mode: 'date',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export class UpdateDatabaseEntriesTask extends PaymentTask {
});
paymentsPaid++;
}
if (paymentsCount == PAYMENTS_COUNT) {
// If a recipient has received all their payments, set their status to former
await recipient.ref.update({
progr_status: RecipientProgramStatus.Former,
});
setToFormerCount++;
}
const nextMonthPaymentDoc = await this.firestoreAdmin
.doc<Payment>(
`${RECIPIENT_FIRESTORE_PATH}/${recipient.id}/${PAYMENT_FIRESTORE_PATH}`,
Expand All @@ -61,13 +68,6 @@ export class UpdateDatabaseEntriesTask extends PaymentTask {
});
paymentsCreated++;
}
if (paymentsCount == PAYMENTS_COUNT) {
// If a recipient has received all their payments, set their status to former
await recipient.ref.update({
progr_status: RecipientProgramStatus.Former,
});
setToFormerCount++;
}
if (recipient.get('progr_status') === RecipientProgramStatus.Designated) {
await recipient.ref.update({
si_start_date: paymentDate.toJSDate(),
Expand Down
3 changes: 2 additions & 1 deletion functions/src/webhooks/admin/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { SurveyManager } from './SurveyManager';
/**
* Batch implementation to create all surveys for all recipients.
* Checks for existing surveys and ignores them. So, it can be called multiple times without creating duplicates.
* The default memory limit of 256MB is not enough for this function.
*/
const createAllSurveysFunction = onCall(async ({ auth }) => {
const createAllSurveysFunction = onCall({ memory: '2GiB' }, async ({ auth }) => {
const firestoreAdmin = new FirestoreAdmin();
await firestoreAdmin.assertGlobalAdmin(auth?.token?.email);

Expand Down
67 changes: 49 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6115d3d

Please sign in to comment.