Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve conflicts #1703

Merged
merged 3 commits into from
Jul 19, 2024
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
32 changes: 16 additions & 16 deletions src/repositories/donationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ export const donationsTotalAmountPerDateRange = async (
.andWhere('project.verified = true');
}

const donationsUsdAmount = await query
.cache(
`donationsTotalAmountPerDateRange-${fromDate || ''}-${toDate || ''}-${
networkId || 'all'
}-${onlyVerified || 'all'}`,
300000,
)
.getRawOne();
const donationsUsdAmount = await query.getRawOne();

Comment on lines +165 to +166
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove redundant variable assignment.

The variable donationsUsdAmount is assigned but not used before the caching operation. This assignment can be removed to streamline the code.

-  const donationsUsdAmount = await query.getRawOne();
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const donationsUsdAmount = await query.getRawOne();

query.cache(
`donationsTotalAmountPerDateRange-${fromDate || ''}-${toDate || ''}-${
networkId || 'all'
}-${onlyVerified || 'all'}`,
300000,
);
Comment on lines +167 to +172
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary caching logic.

The caching logic is redundant and can be removed to simplify the function.

-  query.cache(
-    `donationsTotalAmountPerDateRange-${fromDate || ''}-${toDate || ''}-${
-      networkId || 'all'
-    }-${onlyVerified || 'all'}`,
-    300000,
-  );
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
query.cache(
`donationsTotalAmountPerDateRange-${fromDate || ''}-${toDate || ''}-${
networkId || 'all'
}-${onlyVerified || 'all'}`,
300000,
);


return donationsUsdAmount.sum;
Comment on lines 173 to 174
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the return value.

Ensure the function returns the correct value after removing the caching logic.

-  return donationsUsdAmount.sum;
+  const donationsUsdAmount = await query.getRawOne();
+  return donationsUsdAmount.sum;

Committable suggestion was skipped due to low confidence.

};
Expand Down Expand Up @@ -247,14 +247,14 @@ export const donationsNumberPerDateRange = async (
.andWhere('project.verified = true');
}

const donationsUsdAmount = await query
.cache(
`donationsTotalNumberPerDateRange-${fromDate || ''}-${toDate || ''}--${
networkId || 'all'
}-${onlyVerified || 'all'}`,
300000,
)
.getRawOne();
const donationsUsdAmount = await query.getRawOne();

Comment on lines +250 to +251
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove redundant variable assignment.

The variable donationsUsdAmount is assigned but not used before the caching operation. This assignment can be removed to streamline the code.

-  const donationsUsdAmount = await query.getRawOne();
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const donationsUsdAmount = await query.getRawOne();

query.cache(
`donationsTotalNumberPerDateRange-${fromDate || ''}-${toDate || ''}--${
networkId || 'all'
}-${onlyVerified || 'all'}`,
300000,
);
Comment on lines +252 to +257
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary caching logic.

The caching logic is redundant and can be removed to simplify the function.

-  query.cache(
-    `donationsTotalNumberPerDateRange-${fromDate || ''}-${toDate || ''}--${
-      networkId || 'all'
-    }-${onlyVerified || 'all'}`,
-    300000,
-  );
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
query.cache(
`donationsTotalNumberPerDateRange-${fromDate || ''}-${toDate || ''}--${
networkId || 'all'
}-${onlyVerified || 'all'}`,
300000,
);


return donationsUsdAmount.count;
Comment on lines 258 to 259
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the return value.

Ensure the function returns the correct value after removing the caching logic.

-  return donationsUsdAmount.count;
+  const donationsCount = await query.getRawOne();
+  return donationsCount.count;

Committable suggestion was skipped due to low confidence.

};
Expand Down
Loading