-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
to get uploaded items' count in last x days
to get uploaded items' count in last x days
…/github.com/lahmacunradio/arcsi into dev/daily-weekly-upload-stats-for-analytics
updated swagger docs added constraints on API's variables
arcsi/api/data.py
Outdated
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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
add live episodes number too
There was a problem hiding this 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() |
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:DD thanks for review!!
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).