From fc18423ee7e227556f70141fbaec5d2d5b20e1ab Mon Sep 17 00:00:00 2001 From: james Date: Mon, 7 Oct 2024 16:59:32 +0800 Subject: [PATCH 1/4] clean up columns and network names a bit for demo purposes --- apps/admin-db/pg-init.sql | 5 +++-- apps/dash-backend/api_app/controllers/analytics.py | 11 +++++++++-- .../tests/generate_impressions_and_clicks.py | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/admin-db/pg-init.sql b/apps/admin-db/pg-init.sql index c4c05cd..9fa62e3 100644 --- a/apps/admin-db/pg-init.sql +++ b/apps/admin-db/pg-init.sql @@ -34,10 +34,11 @@ CREATE TABLE networks ( INSERT INTO networks (name, postback_id) VALUES ('Google','google'), -('Facebook', 'meta'), +('Meta', 'meta'), ('AppLovin', 'applovin'), ('Unity Ads', 'unityads'), -('Digital Turbine','digitalturbine'); +('Digital Turbine','digitalturbine'), +('ironSource', 'ironsource'); diff --git a/apps/dash-backend/api_app/controllers/analytics.py b/apps/dash-backend/api_app/controllers/analytics.py index 31503eb..e1a6575 100644 --- a/apps/dash-backend/api_app/controllers/analytics.py +++ b/apps/dash-backend/api_app/controllers/analytics.py @@ -63,11 +63,18 @@ async def get_overview(self: Self, start_date: str, end_date: str) -> OverviewDa apps_df = query_apps().rename(columns={"name": "app_name"}) networks_df = query_networks().rename(columns={"name": "network_name"}) - df = df.merge(apps_df, left_on="store_id", right_on="store_id", how="left") + df = df.merge(apps_df, left_on="store_id", right_on="store_id", how="outer") df = df.merge( - networks_df, left_on="network", right_on="postback_id", how="left", + networks_df, left_on="network", right_on="postback_id", how="outer", ) + df.loc[df["app_name"].isna(), "app_name"] = df.loc[ + df["app_name"].isna(), "store_id", + ] + df.loc[df["network_name"].isna(), "network_name"] = df.loc[ + df["network_name"].isna(), "network", + ] + df["revenue"] = df["revenue"].astype(float) dates_home_df = ( diff --git a/apps/postback-api/tests/generate_impressions_and_clicks.py b/apps/postback-api/tests/generate_impressions_and_clicks.py index 2eb64cb..ba4b482 100644 --- a/apps/postback-api/tests/generate_impressions_and_clicks.py +++ b/apps/postback-api/tests/generate_impressions_and_clicks.py @@ -10,7 +10,7 @@ logger = get_logger(__name__) -NETWORKS = ["google", "ironsource", "facebook"] +NETWORKS = ["google", "ironsource", "meta"] APPS = ["com.example.one", "com.game.eg.gg", "id123456789", "123456789"] CAMPAIGNS = ["CampaignA", "CampaignB"] From 07ae45df2907cccfa703dd5d320051296c035adb Mon Sep 17 00:00:00 2001 From: james Date: Mon, 7 Oct 2024 17:00:34 +0800 Subject: [PATCH 2/4] bump pre-commit --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f84200..8c26c14 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ repos: ### PYTHON # Ruff - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.6.7 + rev: v0.6.9 hooks: - id: ruff args: [--fix] @@ -14,7 +14,7 @@ repos: additional_dependencies: ['types-requests'] ### DOCKER - repo: https://github.com/hadolint/hadolint - rev: v2.13.0-beta + rev: v2.13.1-beta hooks: - id: hadolint-docker ### SHELL @@ -41,7 +41,7 @@ repos: - prettier - prettier-plugin-svelte - repo: https://github.com/pre-commit/mirrors-eslint - rev: v9.11.1 + rev: v9.12.0 hooks: - id: eslint name: eslint From fcabe68dfb0ac921a487bbb1c81f1d646bc33178 Mon Sep 17 00:00:00 2001 From: james Date: Mon, 7 Oct 2024 17:03:36 +0800 Subject: [PATCH 3/4] auto-fixes from pre-commit --- .../src/lib/components/ui/select/index.ts | 14 ++++++------ .../ui/select/select-content.svelte | 22 +++++++++---------- .../components/ui/select/select-item.svelte | 16 +++++++------- .../components/ui/select/select-label.svelte | 8 +++---- .../ui/select/select-separator.svelte | 8 +++---- .../ui/select/select-trigger.svelte | 10 ++++----- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/apps/dash-frontend/src/lib/components/ui/select/index.ts b/apps/dash-frontend/src/lib/components/ui/select/index.ts index 327541c..6b2ec20 100644 --- a/apps/dash-frontend/src/lib/components/ui/select/index.ts +++ b/apps/dash-frontend/src/lib/components/ui/select/index.ts @@ -1,10 +1,10 @@ -import { Select as SelectPrimitive } from "bits-ui"; +import { Select as SelectPrimitive } from 'bits-ui'; -import Label from "./select-label.svelte"; -import Item from "./select-item.svelte"; -import Content from "./select-content.svelte"; -import Trigger from "./select-trigger.svelte"; -import Separator from "./select-separator.svelte"; +import Label from './select-label.svelte'; +import Item from './select-item.svelte'; +import Content from './select-content.svelte'; +import Trigger from './select-trigger.svelte'; +import Separator from './select-separator.svelte'; const Root = SelectPrimitive.Root; const Group = SelectPrimitive.Group; @@ -30,5 +30,5 @@ export { Value as SelectValue, Content as SelectContent, Trigger as SelectTrigger, - Separator as SelectSeparator, + Separator as SelectSeparator }; diff --git a/apps/dash-frontend/src/lib/components/ui/select/select-content.svelte b/apps/dash-frontend/src/lib/components/ui/select/select-content.svelte index 6d73ad3..1989880 100644 --- a/apps/dash-frontend/src/lib/components/ui/select/select-content.svelte +++ b/apps/dash-frontend/src/lib/components/ui/select/select-content.svelte @@ -1,22 +1,22 @@ @@ -27,7 +27,7 @@ {outTransitionConfig} {sideOffset} class={cn( - "bg-popover text-popover-foreground relative z-50 min-w-[8rem] overflow-hidden rounded-md border shadow-md outline-none", + 'bg-popover text-popover-foreground relative z-50 min-w-[8rem] overflow-hidden rounded-md border shadow-md outline-none', className )} {...$$restProps} diff --git a/apps/dash-frontend/src/lib/components/ui/select/select-item.svelte b/apps/dash-frontend/src/lib/components/ui/select/select-item.svelte index 7c00c72..d479922 100644 --- a/apps/dash-frontend/src/lib/components/ui/select/select-item.svelte +++ b/apps/dash-frontend/src/lib/components/ui/select/select-item.svelte @@ -1,15 +1,15 @@ @@ -18,7 +18,7 @@ {disabled} {label} class={cn( - "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50", + 'data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className )} {...$$restProps} diff --git a/apps/dash-frontend/src/lib/components/ui/select/select-label.svelte b/apps/dash-frontend/src/lib/components/ui/select/select-label.svelte index d966450..424bc64 100644 --- a/apps/dash-frontend/src/lib/components/ui/select/select-label.svelte +++ b/apps/dash-frontend/src/lib/components/ui/select/select-label.svelte @@ -1,15 +1,15 @@ diff --git a/apps/dash-frontend/src/lib/components/ui/select/select-separator.svelte b/apps/dash-frontend/src/lib/components/ui/select/select-separator.svelte index 78fc46d..0b08542 100644 --- a/apps/dash-frontend/src/lib/components/ui/select/select-separator.svelte +++ b/apps/dash-frontend/src/lib/components/ui/select/select-separator.svelte @@ -1,11 +1,11 @@ - + diff --git a/apps/dash-frontend/src/lib/components/ui/select/select-trigger.svelte b/apps/dash-frontend/src/lib/components/ui/select/select-trigger.svelte index 8209dfb..0251209 100644 --- a/apps/dash-frontend/src/lib/components/ui/select/select-trigger.svelte +++ b/apps/dash-frontend/src/lib/components/ui/select/select-trigger.svelte @@ -1,18 +1,18 @@ span]:text-muted-foreground flex h-10 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", + 'border-input bg-background ring-offset-background focus-visible:ring-ring aria-[invalid]:border-destructive data-[placeholder]:[&>span]:text-muted-foreground flex h-10 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', className )} {...$$restProps} From a0141e7f1d74b2c85b51edb3827bfc9dfa8be0c1 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 16 Oct 2024 06:09:16 +0800 Subject: [PATCH 4/4] fix typo in url --- apps/docs/blog/posts/svelte-analytics-dash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/blog/posts/svelte-analytics-dash.md b/apps/docs/blog/posts/svelte-analytics-dash.md index 05fd174..352653e 100644 --- a/apps/docs/blog/posts/svelte-analytics-dash.md +++ b/apps/docs/blog/posts/svelte-analytics-dash.md @@ -36,4 +36,4 @@ Meanwhile, I've also completely revamped the docker environment for development - [ ] Pull data from first ad network - [ ] Start iOS and/or Android SDK -Some features are live at [demo.openattribution.com](http://demo.openattribution.com). +Some features are live at [demo.openattribution.dev](http://demo.openattribution.dev).