made corrections based on feedback
This commit is contained in:
@@ -13,7 +13,6 @@ from schemas.router_schemas import (
|
||||
SectorMinimal,
|
||||
)
|
||||
from services.compatibility_score import (
|
||||
calculate_project_investor_compatibility,
|
||||
_calculate_project_fund_compatibility,
|
||||
_calculate_project_investor_direct_compatibility,
|
||||
)
|
||||
@@ -91,7 +90,9 @@ def read_investors(
|
||||
selectinload(InvestorTable.portfolio_companies),
|
||||
selectinload(InvestorTable.team_members),
|
||||
selectinload(InvestorTable.sectors),
|
||||
selectinload(InvestorTable.funds).selectinload(FundTable.investment_stages),
|
||||
selectinload(InvestorTable.funds).selectinload(
|
||||
FundTable.investment_stages
|
||||
),
|
||||
selectinload(InvestorTable.funds).selectinload(FundTable.sectors),
|
||||
)
|
||||
.all()
|
||||
@@ -106,7 +107,9 @@ def read_investors(
|
||||
selectinload(InvestorTable.portfolio_companies),
|
||||
selectinload(InvestorTable.team_members),
|
||||
selectinload(InvestorTable.sectors),
|
||||
selectinload(InvestorTable.funds).selectinload(FundTable.investment_stages),
|
||||
selectinload(InvestorTable.funds).selectinload(
|
||||
FundTable.investment_stages
|
||||
),
|
||||
selectinload(InvestorTable.funds).selectinload(FundTable.sectors),
|
||||
)
|
||||
.offset(offset)
|
||||
@@ -143,7 +146,9 @@ def read_investors(
|
||||
# Get top 3 sectors from fund (id and name only) - sorted alphabetically
|
||||
fund_sectors = [
|
||||
SectorMinimal(id=sector.id, name=sector.name)
|
||||
for sector in sorted(fund.sectors[:3] if fund.sectors else [], key=lambda s: s.name)
|
||||
for sector in sorted(
|
||||
fund.sectors[:3] if fund.sectors else [], key=lambda s: s.name
|
||||
)
|
||||
]
|
||||
|
||||
investment_response = InvestmentResponse(
|
||||
@@ -188,7 +193,7 @@ def read_investors(
|
||||
if project is not None:
|
||||
investment_responses.sort(key=lambda x: x.compatibility_score, reverse=True)
|
||||
# Apply pagination after sorting
|
||||
investment_responses = investment_responses[offset:offset + page_size]
|
||||
investment_responses = investment_responses[offset : offset + page_size]
|
||||
|
||||
# Calculate total pages
|
||||
total_pages = (total_count + page_size - 1) // page_size
|
||||
@@ -320,7 +325,9 @@ def filter_investors(
|
||||
# Get top 3 sectors from fund (id and name only) - sorted alphabetically
|
||||
fund_sectors = [
|
||||
SectorMinimal(id=sector.id, name=sector.name)
|
||||
for sector in sorted(fund.sectors[:3] if fund.sectors else [], key=lambda s: s.name)
|
||||
for sector in sorted(
|
||||
fund.sectors[:3] if fund.sectors else [], key=lambda s: s.name
|
||||
)
|
||||
]
|
||||
|
||||
investment_response = InvestmentResponse(
|
||||
@@ -344,7 +351,7 @@ def filter_investors(
|
||||
investment_responses.sort(key=lambda x: x.compatibility_score, reverse=True)
|
||||
# Apply pagination after sorting
|
||||
offset = (page - 1) * page_size
|
||||
investment_responses = investment_responses[offset:offset + page_size]
|
||||
investment_responses = investment_responses[offset : offset + page_size]
|
||||
|
||||
# Calculate total pages
|
||||
total_pages = (total_count + page_size - 1) // page_size
|
||||
|
||||
Reference in New Issue
Block a user