Skip to content

Commit c27c6dc

Browse files
committed
cache fix and key fix
1 parent d0d3cad commit c27c6dc

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

backend/routers/lib/analysis.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,22 @@ def serialize_local(
235235
ownership_percentage = ratios["ownership_percent"]
236236

237237
share_change = changes["shares"]
238-
share_action = share_change["action"]
239-
share_amount = share_change["amount"]
240-
share_bought = abs(share_amount) if share_action == "buy" else "N/A"
241-
share_sold = abs(share_amount) if share_action == "sell" else "N/A"
238+
share_action = share_change.get("action", "N/A")
239+
share_amount = share_change.get("amount", None)
240+
share_bought = (
241+
abs(share_amount) if share_action == "buy" and share_amount else "N/A"
242+
)
243+
share_sold = abs(share_amount) if share_action == "sell" and share_amount else "N/A"
242244
share_bought_str = f"{int(share_bought):,}" if share_bought != "N/A" else "N/A"
243245
share_sold_str = f"{int(share_sold):,}" if share_sold != "N/A" else "N/A"
244246

245247
value_change = changes["value"]
246-
value_action = value_change["action"]
247-
value_amount = value_change["amount"]
248-
value_bought = abs(value_amount) if value_action == "buy" else "N/A"
249-
value_sold = abs(value_amount) if value_action == "sell" else "N/A"
248+
value_action = value_change.get("action", "N/A")
249+
value_amount = value_change.get("amount", None)
250+
value_bought = (
251+
abs(value_amount) if value_action == "buy" and value_amount else "N/A"
252+
)
253+
value_sold = abs(value_amount) if value_action == "sell" and value_amount else "N/A"
250254
value_bought_str = f"${int(value_bought):,}" if value_bought != "N/A" else "N/A"
251255
value_sold_str = f"${int(value_sold):,}" if value_sold != "N/A" else "N/A"
252256

frontend/components/Progress/Progress.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,14 @@ const Progress = (props) => {
150150
</div>
151151
</div>
152152
<Console loading={loading} logs={log.logs} />
153-
<Link
154-
className={styles["go-back"]}
155-
href={`/filers/${cik}?` + new URLSearchParams({ continuous: true })}
156-
>
157-
Progress
158-
</Link>
153+
{persist ? (
154+
<Link
155+
className={styles["go-back"]}
156+
href={`/filers/${cik}?` + new URLSearchParams({ continuous: true })}
157+
>
158+
Progress
159+
</Link>
160+
) : null}
159161
</div>
160162
{/* <span>View stocks continuously.</span> */}
161163
{persist ? null : <Estimation cik={cik} />}

frontend/pages/filers/[cik]/overview.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,17 @@ export async function getServerSideProps(context) {
7676
.then((r) => validateStatus(r?.status))
7777
.catch((e) => {
7878
console.error(e);
79-
return null;
79+
return validateStatus(e?.response?.status || 500);
8080
});
8181

82+
console.log({
83+
query,
84+
cik,
85+
tab,
86+
persist,
87+
continuous,
88+
});
89+
8290
return {
8391
props: {
8492
query,

0 commit comments

Comments
 (0)