diff --git a/backend/dbcon/queries.py b/backend/dbcon/queries.py index 682b662..aa47956 100644 --- a/backend/dbcon/queries.py +++ b/backend/dbcon/queries.py @@ -431,7 +431,13 @@ def clean_app_df(df: pd.DataFrame) -> pd.DataFrame: play_dev_link, ios_dev_link, ) + df["developer_id"].astype(str) - date_cols = ["created_at", "store_last_updated", "updated_at"] + date_cols = [ + "created_at", + "store_last_updated", + "updated_at", + "adstxt_last_crawled", + "sdk_last_crawled", + ] for x in date_cols: if x not in df.columns: continue diff --git a/backend/dbcon/sql/query_single_app.sql b/backend/dbcon/sql/query_single_app.sql index 9fb3893..b9b9e37 100644 --- a/backend/dbcon/sql/query_single_app.sql +++ b/backend/dbcon/sql/query_single_app.sql @@ -1,5 +1,6 @@ SELECT id, + name, store_id, store, category, diff --git a/frontend/src/routes/apps/[id]/+page.server.ts b/frontend/src/routes/apps/[id]/+page.server.ts index ca8b42a..9da9904 100644 --- a/frontend/src/routes/apps/[id]/+page.server.ts +++ b/frontend/src/routes/apps/[id]/+page.server.ts @@ -32,17 +32,29 @@ export const load: PageServerLoad = async ({ params, parent }) => { const resp = await fetch(`http://localhost:8000/api/apps/${id}/history`); return checkStatus(resp, 'App History'); }; - const myPackageInfo = async () => { - const resp = await fetch(`http://localhost:8000/api/apps/${id}/packageinfo`); - return checkStatus(resp, 'App Package Info'); - }; - const myAdsTxt = async () => { - const resp = await fetch(`http://localhost:8000/api/apps/${id}/adstxt`); - return checkStatus(resp, 'App AdsTxt'); - }; + + // Get the app data first + const app = await myapp(); + + // Conditionally create myPackageInfo based on sdk_crawl_result + let myPackageInfo = async () => null; + if (app.sdk_crawl_result > 0) { + myPackageInfo = async () => { + const resp = await fetch(`http://localhost:8000/api/apps/${id}/packageinfo`); + return checkStatus(resp, 'App Package Info'); + }; + } + + let myAdsTxt = async () => null; + if (app.adstxt_crawl_result === 1) { + myAdsTxt = async () => { + const resp = await fetch(`http://localhost:8000/api/apps/${id}/adstxt`); + return checkStatus(resp, 'App AdsTxt'); + }; + } return { - myapp: myapp(), + myapp: app, myranks: myranks(), myhistory: myhistory(), myPackageInfo: myPackageInfo(), diff --git a/frontend/src/routes/apps/[id]/+page.svelte b/frontend/src/routes/apps/[id]/+page.svelte index 10f5bc0..92dc050 100644 --- a/frontend/src/routes/apps/[id]/+page.svelte +++ b/frontend/src/routes/apps/[id]/+page.svelte @@ -122,8 +122,10 @@ {:then myapp}