mirror of
https://github.com/jaypyles/Scraperr.git
synced 2025-11-02 15:37:04 +00:00
* chore: refactor wip * chore: refactor wip * chore: refactor wip * chore: refactor wip * chore: refactor wip * chore: refactor wip * chore: work in progress * chore: work in progress * chore: work in progress * chore: work in progress * chore: work in progress * chore: work in progress * chore: work in progress * chore: work in progress * chore: work in progress * chore: refactor wip * chore: work in progress * chore: refactor wip * chore: refactor wip * chore: refactor wip * fix: build * fix: cypress test * fix: cypress test * fix: cypress test * fix: cypress test * fix: cypress test * fix: cypress test * fix: cypress test * fix: cypress test * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests * fix: cypress tests
42 lines
833 B
Python
42 lines
833 B
Python
# LOCAL
|
|
from api.backend.database.common import query
|
|
|
|
|
|
async def average_elements_per_link(user: str):
|
|
job_query = """
|
|
SELECT
|
|
DATE(time_created) AS date,
|
|
AVG(json_array_length(elements)) AS average_elements,
|
|
COUNT(*) AS count
|
|
FROM
|
|
jobs
|
|
WHERE
|
|
status = 'Completed' AND user = ?
|
|
GROUP BY
|
|
DATE(time_created)
|
|
ORDER BY
|
|
date ASC;
|
|
"""
|
|
results = query(job_query, (user,))
|
|
|
|
return results
|
|
|
|
|
|
async def get_jobs_per_day(user: str):
|
|
job_query = """
|
|
SELECT
|
|
DATE(time_created) AS date,
|
|
COUNT(*) AS job_count
|
|
FROM
|
|
jobs
|
|
WHERE
|
|
status = 'Completed' AND user = ?
|
|
GROUP BY
|
|
DATE(time_created)
|
|
ORDER BY
|
|
date ASC;
|
|
"""
|
|
results = query(job_query, (user,))
|
|
|
|
return results
|