Skip to content

Commit

Permalink
Merge pull request #14 from Jexoio/replace-loop-return-syntax
Browse files Browse the repository at this point in the history
replace return with continue for loops
  • Loading branch information
birox authored Apr 19, 2020
2 parents 19a235d + b9ba7ac commit cc2348d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const checkNewTrials = async () => {
});
if(!isEventRegistered || !isEventRegistered.Item) {
const wasSent = await sendNewTrial({license, eventName});
if(!wasSent) return;
if(!wasSent) continue;
await postEventDB({
key: dbRecordKey,
value: convertDate(new Date())
Expand All @@ -39,7 +39,7 @@ const checkNewTrials = async () => {
});
if(!isMarketingAttributionRegistered || !isMarketingAttributionRegistered.Item) {
const wasSent = await sendMarketingAttribution(license);
if(!wasSent) return;
if(!wasSent) continue;
await postEventDB({
key: dbMarketingAttributionRecordKey,
value: convertDate(new Date())
Expand All @@ -56,12 +56,11 @@ const checkTransactions = async () => {
const eventName = 'subscription_paid';

//start temporary fix
if(greaterThan(twoWeeksAgo(), transaction.purchaseDetails.maintenanceEndDate)) return;
const dbRecordKeyLegacy = `${eventName}-${transaction.transactionId}`;
const isEventRegisteredLegacy = await fetchEventDB({
key: dbRecordKeyLegacy
});
if(isEventRegisteredLegacy.item) return;
if(isEventRegisteredLegacy.item) continue;
//end temporary fix

const dbRecordKey = `${eventName}-${transaction.addonLicenseId}-${transaction.transactionId}`;
Expand All @@ -70,7 +69,7 @@ const checkTransactions = async () => {
});
if(!isEventRegistered || !isEventRegistered.Item) {
const wasSent = await sendTransaction({transaction, eventName});
if(!wasSent) return;
if(!wasSent) continue;
await postEventDB({
key: dbRecordKey,
value: convertDate(new Date())
Expand All @@ -90,7 +89,7 @@ const checkExpiredAndCancelledTrials = async () => {
});
if(!isEventRegistered || !isEventRegistered.Item) {
const wasSent = await sendExpiredAndCancelledTrial({license, eventName});
if(!wasSent) return;
if(!wasSent) continue;
await postEventDB({
key: dbRecordKey,
value: convertDate(new Date())
Expand All @@ -110,7 +109,7 @@ const checkChurnedSubscriptions = async () => {
});
if(!isEventRegistered || !isEventRegistered.Item) {
const wasSent = await sendChurnedSubscription({license, eventName});
if(!wasSent) return;
if(!wasSent) continue;
await postEventDB({
key: dbRecordKey,
value: convertDate(new Date())
Expand Down

0 comments on commit cc2348d

Please sign in to comment.