Skip to content

Commit

Permalink
feat(public): update range for fetching jw.org schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Feb 26, 2023
1 parent 8544350 commit de176ea
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ lmm-oa-sws
.env.test.local
.env.production.local
jwt.js
sample.json

npm-debug.log*
yarn-debug.log*
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"i18next": "^22.4.10",
"is-online": "^10.0.0",
"jsdom": "^21.1.0",
"jw-epub-parser": "^1.32.1",
"jw-epub-parser": "^1.33.0",
"node-2fa": "^2.0.3",
"node-fetch": "^3.3.0",
"nodemailer": "^6.9.1",
Expand Down
26 changes: 13 additions & 13 deletions src/utils/congregation-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ import { Congregation } from '../classes/Congregation.js';
const db = getFirestore(); //get default database

export const dbFetchCongregations = async () => {
const congRef = db.collection('congregations');
const snapshot = await congRef.get();
const congRef = db.collection('congregations');
const snapshot = await congRef.get();

const items = [];
const items = [];

snapshot.forEach((doc) => {
items.push(doc.id);
});
snapshot.forEach((doc) => {
items.push(doc.id);
});

const finalResult = [];
const finalResult = [];

for (let i = 0; i < items.length; i++) {
const cong = new Congregation(items[i]);
await cong.loadDetails();
finalResult.push(cong);
}
for (let i = 0; i < items.length; i++) {
const cong = new Congregation(items[i]);
await cong.loadDetails();
finalResult.push(cong);
}

return finalResult;
return finalResult;
};
4 changes: 1 addition & 3 deletions src/utils/encryption-utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Cryptr from 'cryptr';

const isProd = process.env.NODE_ENV === 'production';

const myKey = `&sws2apps_${isProd ? process.env.SEC_ENCRYPT_KEY : 'your-secret-encryption-string'}`;
const myKey = `&sws2apps_${process.env.SEC_ENCRYPT_KEY}`;
const cryptr = new Cryptr(myKey);

export const encryptData = (data) => {
Expand Down
6 changes: 6 additions & 0 deletions src/utils/public-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export const fetchData = async (language) => {
let monthMwb = monthOdd ? currentMonth : currentMonth - 1;
let currentYear = weekDate.getFullYear();

monthMwb = monthMwb - 2;
if (monthMwb === -1) {
monthMwb = 11;
currentYear--;
}

const issues = [];

do {
Expand Down

0 comments on commit de176ea

Please sign in to comment.