Skip to content

Commit

Permalink
Feedback archived per month (#530)
Browse files Browse the repository at this point in the history
* add feedbacks archived per day

* add the query of archived in main file

* query archived feedbacks per day

* query archived feedbacks per month
  • Loading branch information
yasmineDoghri6 authored Apr 26, 2024
1 parent 133202c commit 1fe3a4f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions usage-analytics/create-analytics/feedbacks_archived_per_month.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
WITH
archived_feedbacks AS (
SELECT
JSON_EXTRACT_SCALAR(DATA, "$.archived") AS archived,
DATE_TRUNC(TIMESTAMP_MILLIS(CAST(JSON_EXTRACT_SCALAR(DATA, "$.createdAt") AS INT)), Month) AS Month
FROM
`firestore_export.feedback_raw_latest`
WHERE
JSON_EXTRACT_SCALAR(DATA, "$.archived") != "0" )
SELECT
COUNT(*) feedbacks_archived,
month,
CASE
WHEN archived ="1" THEN "Giver"
WHEN archived ="2" THEN "Receiver"
WHEN archived ="3" THEN "Both"
END
AS archived_for
FROM
archived_feedbacks
GROUP BY
archived_for,
month
3 changes: 2 additions & 1 deletion usage-analytics/create-analytics/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ def create_analytics_tables(*_):
# This query answer the question "how old are the feedbacks requests today?"
execute_query("feedbacks_requests_age_repartition.sql", "feedzback_usage", "feedbacks_requests_age_repartition")
# This query answer the question "how many feedbacks are archived each day/month (without counting the feedbacks requests)"
execute_query("feedbacks_archived_per_day.sql", "feedzback_usage", "feedbacks_archived_per_day")
execute_query("feedbacks_archived_per_day.sql", "feedzback_usage", "feedbacks_archived_per_day")
execute_query("feedbacks_archived_per_month.sql", "feedzback_usage", "feedbacks_archived_per_month")
return 'OK'

0 comments on commit 1fe3a4f

Please sign in to comment.