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

JS API: Add Remaining Card Properties #6766

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

david-allison
Copy link
Member

@david-allison david-allison commented Jul 28, 2020

Purpose / Description

Properties weren't available and were requested. Added them all: factor, id, mod, nid, type, did, left, odid, odue

Fixes

Fixes #5587

Approach

Provide the properties

How Has This Been Tested?

Untested

Checklist

  • You have not changed whitespace unnecessarily (it makes diffs hard to read)
  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • Your code follows the style of the project (e.g. never omit braces in if statements)
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code

@david-allison
Copy link
Member Author

@Anthropos888 @infinyte7 Does the format of these properties seem sensible to you guys?

@david-allison
Copy link
Member Author

Potential discussion points:

  • Naming of created: Created/CreationTime
  • Is sending a unix timstamp the best way?
  • Should the ease be a double (2.5), or the database value of 2500? Do we want to call it factor or ease

Copy link
Member

@Arthur-Milchior Arthur-Milchior left a comment

Choose a reason for hiding this comment

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

I do like the idea. Is there any reason why you add access to those values, and not all values from the database simultaneously ?

@krmanik
Copy link
Member

krmanik commented Jul 29, 2020

The value stored in Ankidroid should be passed and details about changing it, should be provided in wiki. It will help in designing card with exact numbers. For example. eta is passed, not eta*60. But if it needs to changed then also okay.

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels Jul 29, 2020
@mikehardy
Copy link
Member

javascript can consume unix epoch timestamps directly in new Date(millisSince1970) so that's good

javascript only has a number numeric type, and it is a double. Number should be sent to javascript as doubles if possible, or if not they should probably be strings so that they are not modified in anyway and javascript can figure out how to handle them, as @infinyte7 mentions (via parseInt(number, radix) or similar

Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

comments on naming and datatypes

@david-allison
Copy link
Member Author

Other methods in the class are returning long/int.

I'll return these until we decide to move to String/double, as these will all need to be tested at once.

@david-allison
Copy link
Member Author

Noting: ankiGetCardInterval should be ankiGetCardIvl

@david-allison
Copy link
Member Author

Pushed - added all properties as requested by Arthur. Names and data types now match the AnkiDroid codebase

@david-allison david-allison changed the title JS API: Add: ease, id, creation and modified time JS API: Add Remaining Card Properties Aug 2, 2020
@david-allison david-allison added Needs Review and removed Needs Author Reply Waiting for a reply from the original author labels Aug 2, 2020
factor, id, mod, nid, type, did, left, odid, odue

Fixes 5587
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

fantastic

@mikehardy mikehardy merged commit 4454790 into ankidroid:master Aug 3, 2020
@mikehardy mikehardy added this to the 2.13 release milestone Aug 3, 2020
lonewolf2208 pushed a commit to lonewolf2208/Anki-Android that referenced this pull request Sep 22, 2022
lonewolf2208 pushed a commit to lonewolf2208/Anki-Android that referenced this pull request Sep 22, 2022
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.

Feature request: add card state and properties to card.html
4 participants