Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@angordev21
Copy link
Collaborator

@angordev21 angordev21 commented Oct 17, 2025

Intent

  • Add advanced Angor project stats to the query/Angor/projects/:projectID/stats API endpoint.
  • Add amountSpentSoFarByInvestorNoPenalty property to the AdvancedProjectStats interface (the logic collecting this stats is disabled until Angor v2).

Implementation

  • Added getAdvancedProjectStats function to backend/src/api/angor/angor-stats.ts file.
  • Updated logic in the backend/src/api/angor/angor.routes.ts to use getAdvancedProjectStats function instead of computeAdvancedStats function.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds advanced project statistics calculation for Angor projects, introducing a new getAdvancedProjectStats function and extending the statistics interface to include a new property for tracking investor spending without penalties (disabled until Angor v2).

Key changes:

  • Implemented getAdvancedProjectStats function in angor-stats.ts to analyze blockchain transactions and categorize spending patterns
  • Added amountSpentSoFarByInvestorNoPenalty property to AdvancedProjectStats interface with placeholder logic for future Angor v2 support
  • Refactored the stats collection logic in angor.routes.ts to use the new async function instead of the previous synchronous approach

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
frontend/sync-assets.js Added input validation to prevent malformed downloads and fixed typo in URL replacement
backend/src/api/angor/angor.routes.ts Refactored to use new getAdvancedProjectStats function and added new stats property
backend/src/api/angor/angor-stats.ts Added new async getAdvancedProjectStats function with blockchain transaction analysis logic
backend/src/api/angor/angor-stats.test.ts Added comprehensive test coverage for the new stats function with mock transaction data

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

0
);
} else {
// The following kinf of transaction are planned in Angor projects v2.
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'kinf' to 'kind'.

Suggested change
// The following kinf of transaction are planned in Angor projects v2.
// The following kind of transaction are planned in Angor projects v2.

Copilot uses AI. Check for mistakes.
if (filteredInvestments.length > 0) {
const spentVouts: AngorVout[][] = await Promise.all(
await Promise.all(
investments.map(async (investment) => {
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The result of Promise.all is not being used. Since getAdvancedProjectStats is called for side effects (accumulating stats), this creates a fire-and-forget pattern that could lead to race conditions where stats might not be fully accumulated before being returned. The await should be kept, but the mapping function should properly wait for each investment's stats to be accumulated.

Suggested change
investments.map(async (investment) => {
filteredInvestments.map(async (investment) => {

Copilot uses AI. Check for mistakes.
amountSpentSoFarByInvestorNoPenalty: 0,
};

// scriptpubkey_type v1_p2tr indicates that it a stage vout
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

Missing word in comment. Should be 'that it is a stage vout'.

Suggested change
// scriptpubkey_type v1_p2tr indicates that it a stage vout
// scriptpubkey_type v1_p2tr indicates that it is a stage vout

Copilot uses AI. Check for mistakes.
@dangershony dangershony merged commit 7d22a6c into master Oct 21, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants