Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
fixed string float comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
leftmove committed Feb 20, 2024
1 parent 9e86f57 commit 417651b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions routers/utils/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,20 +662,22 @@ def sort_and_format(filer_ciks):

for cik in filer_ciks:
filer = database.find_filer(cik, project)
if filer != None:
if filer:
filers.append(filer)

try:
filers_sorted = sorted(
filers, key=lambda c: c.get("market_value", -1), reverse=True
filers, key=lambda c: c.get("market_value", 0), reverse=True
)
for filer in filers_sorted:
filer["date"] = datetime.utcfromtimestamp(filer["updated"]).strftime(
"%Y-%m-%d"
)
filer["market_value"] = (
f"${int(filer['market_value']):,}"
if filer.get("market_value") and filer["market_value"] > 0
if filer.get("market_value")
and filer["market_value"] != "NA"
and filer["market_value"] > 0
else "NA"
)
filer.pop("_id", None)
Expand Down

0 comments on commit 417651b

Please sign in to comment.