Skip to content

Commit

Permalink
Bump pre-commit and fix some ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ddxv committed Feb 23, 2024
1 parent e444711 commit 08814e9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# Ruff
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.2.1
rev: v0.2.2
hooks:
- id: ruff
args: [--fix]
Expand Down
1 change: 1 addition & 0 deletions backend/api_app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Init."""
1 change: 1 addition & 0 deletions backend/dbcon/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Init dbcon."""
2 changes: 1 addition & 1 deletion backend/dbcon/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
logger = get_logger(__name__)


def open_ssh_tunnel(server_name: str): # ruff: ignore
def open_ssh_tunnel(server_name: str): # noqa: ANN201
"""Create SSH tunnel when working remotely."""
from sshtunnel import SSHTunnelForwarder

Expand Down
22 changes: 11 additions & 11 deletions backend/dbcon/sql/query_top_companies.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@ counts AS (
COUNT(DISTINCT sac.store_app) AS app_count
FROM
adtech.store_apps_companies sac
LEFT JOIN adtech.company_categories cc
ON
sac.company_id = cc.company_id
LEFT JOIN adtech.company_categories cc ON
sac.company_id = cc.company_id
LEFT JOIN adtech.categories cat ON
cc.category_id = cat.id
WHERE
cat.id IN :categories
GROUP BY
sac.company_id
),

total_app_count AS (
SELECT
COUNT(DISTINCT store_app)
FROM
adtech.store_apps_companies
)

SELECT
c.name AS name,
tc.app_count,
total_app_count.count AS total_app_count,
(
tc.app_count / total_app_count.count::decimal
) AS PERCENT
FROM
) AS percent
FROM
counts AS tc
LEFT JOIN adtech.companies AS c
ON
tc.company_id = c.id
INNER JOIN total_app_count
ON TRUE
ORDER BY
LEFT JOIN adtech.companies AS c ON
tc.company_id = c.id
INNER JOIN total_app_count ON
TRUE
ORDER BY
tc.app_count DESC;

0 comments on commit 08814e9

Please sign in to comment.