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

feat: Add more fields to CardReviewData #798

Merged
merged 10 commits into from
Nov 9, 2023

Conversation

RisingOrange
Copy link
Collaborator

@RisingOrange RisingOrange commented Nov 9, 2023

This PR adds the total_card_reviews_last_7_days and first_card_review_at fields to CardReviewData and adds the logic to get the values for these fields.

Related issues

Proposed changes

  • Add total_card_reviews_last_7_days and first_card_review_at fields to ankihub.ankihub_client.models.CardReviewData
  • Modify the logic in ankihub.main.review_data to get the values for the fields and set them on the CardReviewData objects sent to the API
  • Update tests

@RisingOrange RisingOrange marked this pull request as ready for review November 9, 2023 16:09
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #798 (ba7cc3c) into main (ad46745) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #798      +/-   ##
==========================================
+ Coverage   81.81%   81.83%   +0.01%     
==========================================
  Files          64       64              
  Lines        5737     5743       +6     
==========================================
+ Hits         4694     4700       +6     
  Misses       1043     1043              
Files Coverage Δ
ankihub/ankihub_client/models.py 98.21% <100.00%> (+0.02%) ⬆️
ankihub/main/review_data.py 100.00% <100.00%> (ø)

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

"""
SELECT MAX(r.id)
SELECT MIN(r.id), MAX(r.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

I really like how this was built in a way that the change to get the new data was really simple! 💯

Comment on lines +30 to +32
total_card_reviews_last_7_days = _get_review_count_for_ah_deck_since(
ah_did, now - timedelta(days=7)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, really nice that you could reuse this method! 💯

@RisingOrange RisingOrange merged commit 4460f1e into main Nov 9, 2023
@RisingOrange RisingOrange deleted the feat/add-more-review-data-fields branch November 9, 2023 19:07
RisingOrange added a commit that referenced this pull request Nov 10, 2023
* Add fields to `CardReviewData`

* Get field values from db and add them to review data

* Begin updating tests

* Change log message

* fixup get_first_and_last

* Update tests

* Add comment

* Remove newline
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