Comments (18)
I reopened because I want to implement the random mock #11 (comment)
Hope you will leave a note here on a dialog with the Anki developers
from anki-apkg-export.
It's not ready to be closed, context: #14 (comment)
from anki-apkg-export.
What about removing random generation / new Date during work? It makes harder to compare values and give no pros. We can just have incremented counter for each deck
That's a good question 👍 Got me thinking that we can simply mock Date
and Math.random
entirely. E.g. Run once and log every randomly generated value in tests, write an archive to the fixtures
directory, then insert it as mocks.
P.S. just note - why export when class import data into Anki deck?
Exporting data from JavaScript to an Anki apkg
format archive.
from anki-apkg-export.
Is there any pros from random data inside exporter? We create each deck from scratch. So we can iterate from 1 up to. And it allow sort cards by import order ( right know we can't do it )
Also if in future we'll add ability to work with existing collections ( add new cards to existing decks ) random numbers can make a bad joke
from anki-apkg-export.
Is there any pros from random data inside exporter?
It's in the spec (http://decks.wikia.com/wiki/Anki_APKG_format_documentation)
allow sort cards by import order ( right know we can't do it )
If it is missing in the spec, it's meaningless in a case of existing apps. Elaborate where do you want to sort cards, please.
Also if in future we'll add ability to work with existing collections
I have a separate module in mind for import (haven't tested yet) https://github.com/davidey/anki-to-json
from anki-apkg-export.
it says random
but I can even imagine cases which not covered with incremented values
from anki-apkg-export.
Elaborate where / why do you want to sort cards, please.
from anki-apkg-export.
https://github.com/ewnd9/anki-apkg-export/blob/d272b9290eb66489fa0a3bf896cb39e6db667ec3/test/test.js#L90 for example
also using random potentialy can generate conflict with identical ids for different rows
from anki-apkg-export.
Do you think this is a shared problem between every Anki client / implementation?
from anki-apkg-export.
not sure. I'm as user never think about ids. But as for developer - using random
numbers is strange
from anki-apkg-export.
I recommend reaching Anki
developers for discussing the purpose of random
in DB or maintaining your own fork because I'm not intended to deviate from the spec.
from anki-apkg-export.
I understand. Maybe you can share link to main repo? Is it https://github.com/dae/anki ?
from anki-apkg-export.
Yes
from anki-apkg-export.
https://anki.tenderapp.com/discussions/add-ons/8620-information-about-database-structuredetails
from anki-apkg-export.
and using random doesn't provide uniq
from anki-apkg-export.
Spec was a lie 😳
I made a little source code research, both the original Anki app and Ankidroid use timestamp + in loop increment for uniqueness, so a pull request to recreate a similar behavior is welcomed.
anki:
https://github.com/dae/anki/blob/24b451b0e4cfb50191e294052363a79f69f35c02/anki/notes.py#L17
https://github.com/dae/anki/blob/24b451b0e4cfb50191e294052363a79f69f35c02/anki/utils.py#L193-L200
ankidroid:
https://github.com/ankidroid/Anki-Android/blob/a6b58f2fc9a8fbf686fe6eaf2a42b76ed5d9a84f/AnkiDroid/src/main/java/com/ichi2/libanki/Note.java#L71
https://github.com/ankidroid/Anki-Android/blob/a6b58f2fc9a8fbf686fe6eaf2a42b76ed5d9a84f/AnkiDroid/src/main/java/com/ichi2/libanki/Utils.java#L385-L393
Also db structure description
https://github.com/ankidroid/Anki-Android/wiki/Database-Structure
wiki spec (random, lie)
http://decks.wikia.com/wiki/Anki_APKG_format_documentation
ruby (uses random)
https://github.com/albertzak/anki2/blob/master/lib/anki2.rb#L33
from anki-apkg-export.
Ok, thx
But using timestamp still confuse me, use increment is more habitual ( for me at least ) and covers the same limitation. But I'll create PR with the same behavior
from anki-apkg-export.
from anki-apkg-export.
Related Issues (20)
- Media support HOT 3
- Don't expose `SEPARATOR` HOT 2
- Import of cards with tags is incomplete HOT 3
- Can't pass APP_ENV to project, built with create-react-app HOT 2
- Uncaught Error: Cannot find module "script!sql.js" HOT 8
- Back card side doesn't have front side repeated HOT 1
- Cannot enlarge memory arrays - Possible to modify sql.js file? HOT 2
- Difficulties with installing anki-apkg-export HOT 2
- Add ability to add custom question & answer templates
- Replace ruby gem reference in README
- Memory issue HOT 3
- Update dependencies HOT 2
- Is there a way to avoid importing duplicates when regenerating identical/updated cards? HOT 6
- Future direction of Project? HOT 4
- Does it support tags? other anki features? HOT 6
- support for subdecks HOT 4
- Is there way to create Anki deck in browser?
- What will be implementation for this resolve error in webpack bundling?
- Cannot find module 'script-loader!sql.js' from 'node_modules/anki-apkg-export/dist/index.js' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anki-apkg-export.