Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New endpoint for analytics #159

Merged
merged 8 commits into from
Dec 10, 2022

Conversation

tuz666
Copy link
Collaborator

@tuz666 tuz666 commented Nov 20, 2022

Added 2 new API endpoints which returns the sum of the uploaded items during the last x days/weeks from the given date.
Introduced new statistics related view pages on Arcsi UI, to be able to reach these info without Postman requests.
Updated the Swagger docs according to this.
Also added some constraints on API URL's variables, in order to prevent incorrect API calls (changes in item.py, show.py, user.py).

to get uploaded items' count in last x days
@tuz666 tuz666 temporarily deployed to dev November 20, 2022 08:42 Inactive
to get uploaded items' count in last x days
@tuz666 tuz666 temporarily deployed to dev November 20, 2022 08:45 Inactive
@tuz666 tuz666 marked this pull request as draft November 20, 2022 08:45
updated swagger docs
added constraints on API's variables
@tuz666 tuz666 temporarily deployed to dev December 3, 2022 20:47 Inactive
@tuz666 tuz666 temporarily deployed to dev December 3, 2022 20:54 Inactive
@tuz666 tuz666 requested review from pvj, baxgas, gammaw and molnar-a December 4, 2022 09:31
@tuz666 tuz666 marked this pull request as ready for review December 4, 2022 09:33
@tuz666 tuz666 marked this pull request as draft December 4, 2022 12:54
@tuz666 tuz666 temporarily deployed to dev December 4, 2022 13:49 Inactive
@tuz666 tuz666 marked this pull request as ready for review December 4, 2022 13:51
episodes_count = Item.query.filter(
given_date - timedelta(days=last_days) <= Item.play_date
).filter(Item.play_date <= datetime.today()
).filter(Item.archived == True).count()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuz666 it seems we don't count live episods that we haven't archived yet. I think we should, cause they have been aired too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I forgot about them, fixed this in the latest commit!

@@ -97,7 +97,7 @@ def list_items_latest():
return items_archive_schema.dumps(items.items)


@arcsi.route("/item/<id>", methods=["GET"])
@arcsi.route("/item/<int:id>", methods=["GET"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuz666 if possible, in the future, add such fixes separately (on a new branch/PR) or at least via separate commits.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yepp, I will do that way next time!

@tuz666 tuz666 requested a review from gammaw December 8, 2022 10:21
@tuz666 tuz666 temporarily deployed to dev December 8, 2022 10:21 — with GitHub Actions Inactive
Copy link
Member

@gammaw gammaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tuz666 for the fast & quality implementation of this!

@@ -22,7 +22,7 @@ def uploaded_episodes_in_last_x_days():
episodes_count = Item.query.filter(
given_date - timedelta(days=last_days) <= Item.play_date
).filter(Item.play_date <= datetime.today()
).filter(Item.archived == True).count()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuz666 elegant! Adding features by deleting code ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:DD thanks for review!!

@tuz666 tuz666 merged commit 546be94 into master Dec 10, 2022
@pvj pvj deleted the dev/daily-weekly-upload-stats-for-analytics branch January 29, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants