Commit graph

106 commits

Author SHA1 Message Date
Damien Elmes
55f4b9b7d0 favour integers, change due representation, fact&card ordering, more
- removed 'created' column from various tables. We don't care when things like
  models are created, and card creation time didn't reflect the actual time a
  card was created
- facts were previously ordered by their creation date. The code would
  manually set the creation time for subsequent facts on import by 0.0001
  seconds, and then card due times were set by adding the fact time to the
  ordinal number*0.000001. This was prone to error, and the number of zeros used
  was actually different in different parts of the code. Instead of this, we
  replace it with a 'pos' column on facts, which increments for each new fact.
- importing should add new facts with a higher pos, but concurrent updates in
  a synced deck can have multiple facts with the same pos

- due times are completely different now, and depend on the card type
- new cards have due=fact.pos or random(0, 10000)
- reviews have due set to an integer representing days since deck
  creation/download
- cards in the learn queue use an integer timestamp in seconds

- many columns like modified, lastSync, factor, interval, etc have been converted to
  integer columns. They are cheaper to store (large decks can save 10s of
  megabytes) and faster to search for.

- cards have their group assigned on fact creation. In the future we'll add a
  per-template option for a default group.

- switch to due/random order for the review queue on upgrade. Users can still
  switch to the old behaviour if they want, but many people don't care what
  it's set to, and due is considerably faster, which may result in a better
  user experience
2011-04-28 09:23:28 +09:00
Damien Elmes
bb79b0e17c add new 'groups' concept, refactor deletions
Users who want to study small subsections at one time (eg, "lesson 14") are
currently best served by creating lots of little decks. This is because:
- selective study is a bit cumbersome to switch between
- the graphs and statitics are for the entire deck
- selective study can be slow on mobile devices - when the list of cards to
  hide/show is big, or when there are many due cards, performance can suffer
- scheduling can only be configured per deck

Groups are intended to address the above problems. All cards start off in the
same group, but they can have their group changed. Unlike tags, cards can only
be a member of a single group at once time. This allows us to divide the deck
up into a non-overlapping set of cards, which will make things like showing
due counts for a single category considerably cheaper. The user interface
might want to show something like a deck browser for decks that have more than
one group, showing due counts and allowing people to study each group
individually, or to study all at once.

Instead of storing the scheduling config in the deck or the model, we move the
scheduling into a separate config table, and link that to the groups table.
That way a user can have multiple groups that all share the same scheduling
information if they want.

And deletion tracking is now in a single table.
2011-04-28 09:23:28 +09:00
Damien Elmes
2d1d946504 refactor media
- created->modified
- size->refcnt
- originalPath->chksum
- remove description
2011-04-28 09:23:28 +09:00
Damien Elmes
f828393de3 rename deck.s to a more understable deck.db; keep s for compat 2011-04-28 09:21:07 +09:00
Damien Elmes
9421a037f6 remove self explanatory module docstrings; strip trailing whitespace 2011-04-28 09:21:07 +09:00
Damien Elmes
c79db601c6 typo 2011-02-14 03:22:08 +09:00
Damien Elmes
e9ec7f3649 don't escape remote image links
thanks to mark (mhl) for the report
2011-02-14 03:13:16 +09:00
Damien Elmes
09e6e1bd65 fix media db check freezing interface if no media folder 2011-02-02 22:04:12 +09:00
Damien Elmes
9bf850c701 don't allow & in filenames as qt tries to escape them in a string 2011-02-02 18:44:49 +09:00
Damien Elmes
80bb59024c utility for percent-escaping images 2011-02-02 18:36:58 +09:00
Damien Elmes
744cf3b16c don't create empty media folder in upgrade 2011-01-26 13:59:54 +09:00
Damien Elmes
0fc662a919 don't try to delete normalized version 2011-01-19 02:34:13 +09:00
Damien Elmes
e55d4768a3 normalize for check, but not for db 2011-01-18 01:18:29 +09:00
Damien Elmes
0a9c498cbd fix media db check on non-unicode dir 2011-01-14 22:50:03 +09:00
Damien Elmes
31df2fac01 work around osx decomposing files on HFS+ partitions. sigh. 2011-01-13 23:32:25 +09:00
Damien Elmes
f0bf1989bc new code to download remote links and replace with local ones 2010-12-25 12:42:28 +09:00
Damien Elmes
5c4d7b1789 don't include http/ftp links in media db 2010-12-17 21:29:48 +09:00
Damien Elmes
acb72327b2 don't leave stale entries in media db if just scanning 2010-12-16 01:42:12 +09:00
Damien Elmes
4e5b725166 and make sure xhtml syntax works too 2010-12-16 01:22:23 +09:00
Damien Elmes
2a629a179d add missing trailing > to img regexp 2010-12-16 01:12:45 +09:00
Damien Elmes
9ed9ec79cc make them case-insensitive too 2010-12-13 06:56:04 +09:00
Damien Elmes
525f44c9c5 more robust img regexp 2010-12-13 06:54:40 +09:00
Damien Elmes
98304accb0 return actual checksum, or sqlite tries to treat it like an int 2010-12-11 16:30:26 +09:00
Damien Elmes
7a196b3747 don't bother to return used media 2010-12-11 02:13:37 +09:00
Damien Elmes
0c9672e7b8 rewrite media support
- media is no longer hashed, and instead stored in the db using its original
  name
- when adding media, its checksum is calculated and used to look for
  duplicates
- duplicate filenames will result in a number tacked on the file
- the size column is used to count card references to media. If media is
  referenced in a fact but not the question or answer, the count will be zero.
- there is no guarantee media will be listed in the media db if it is unused
  on the question & answer
- if rebuildMediaDir(delete=True), then entries with zero references are
  deleted, along with any unused files in the media dir.
- rebuildMediaDir() will update the internal checksums, and set the checksum
  to "" if a file can't be found
- rebuildMediaDir() is a lot less destructive now, and will leave alone
  directories it finds in the media folder (but not look in them either)
- rebuildMediaDir() returns more information about the state of media now
- the online and mobile clients will need to to make sure that when
  downloading media, entries with no checksum are non-fatal and should not
  abort the download process.
- the ref count is updated every time the q/a is updated - so the db should be
  up to date after every add/edit/import
- since we look for media on the q/a now, card templates like '<img
  src="{{{field}}}">' will work now
- export original files as gone as it is not needed anymore
- move from per-model media URL to deckVar. downloadMissingMedia() uses this
  now. Deck subscriptions will have to be updated to share media another way.
- pass deck in formatQA, as latex support is going to change
2010-12-11 01:19:31 +09:00
Damien Elmes
1bbffec0d6 abort download missing media early; remove obsolete forceMediaDir 2010-12-09 12:53:01 +09:00
Damien Elmes
cb533d9c02 don't die when filename case is borked in media check 2010-08-16 19:28:45 +09:00
Damien Elmes
7f75364fbe delete mediamissing tags before setting 2010-03-28 10:18:13 +09:00
Damien Elmes
863d3d8319 add stripMedia() 2010-01-29 20:20:00 +09:00
Damien Elmes
6f27ae52cc revert to old style file-only latex handling 2009-07-08 12:20:56 +09:00
Damien Elmes
932440165a when files have been modified, make sure to retain originalPath 2009-07-04 15:17:49 +09:00
Damien Elmes
670439c805 support for exporting original filenames 2009-07-04 14:56:25 +09:00
Damien Elmes
03dff653ab handle latex too 2009-06-23 06:41:19 +09:00
Damien Elmes
28a45a4f4c add support for downloading missing media 2009-06-23 06:30:14 +09:00
Damien Elmes
4d1ea887dd rename rather than copy file if same name but different case in media check 2009-06-04 04:20:19 +09:00
Damien Elmes
94f7775b7f remove space from missing media tag 2009-02-24 01:23:47 +09:00
Damien Elmes
d0fa667717 don't report deletions when renamed, assert checksum on client 2009-02-04 22:33:49 +09:00
Damien Elmes
334d126237 recording & noise profile support on linux 2009-01-17 01:05:39 +09:00
Damien Elmes
87fbd896fc fix undo bugs, add progress, improve progress of check media db 2009-01-16 18:54:32 +09:00
Damien Elmes
8bdb1b8c26 remove debug info 2009-01-16 18:18:19 +09:00
Damien Elmes
240d311ca0 optimize add/deleteTag(), add progress callbacks and check (media) db 2009-01-16 18:17:36 +09:00
Damien Elmes
7e74fe3844 fix media dir problem on win32, fix unicode issues with media 2009-01-05 08:20:49 +09:00
Damien Elmes
a9c04a69d1 fix tagging in check media db 2009-01-04 10:03:32 +09:00
Damien Elmes
35ef8e6fa9 make sure both args are unicode 2008-12-24 15:11:35 +09:00
Damien Elmes
3b3fef4ebc refactor latex into media support 2008-12-23 18:00:12 +09:00
Damien Elmes
a6f7276b03 no need to rename on a case insensitive filename 2008-12-20 16:26:51 +09:00
Damien Elmes
499b6b76fc try again.. 2008-12-20 16:14:39 +09:00
Damien Elmes
1877bc6769 possible fix for case insensitive filenames 2008-12-20 16:06:04 +09:00
Damien Elmes
d027892c5c always downcase media extensions, fix path on win32 2008-12-13 13:40:14 +09:00
Damien Elmes
dacd318ffd conditionally encode path in media 2008-12-11 04:13:57 +09:00
Damien Elmes
7f9593816c prevent unicode error when pasting image 2008-12-11 03:27:05 +09:00
Damien Elmes
634362dc76 encode media filename to unicode first 2008-12-11 01:13:52 +09:00
Damien Elmes
3afcf982dd fix 'delete' option of media check 2008-12-10 22:05:44 +09:00
Damien Elmes
75a61a00cc remove card tags 2008-11-28 14:40:27 +09:00
Damien Elmes
b2d0e5d3df wip 2008-11-07 18:44:49 +09:00
Damien Elmes
5da3a0f5d3 initial commit from hg 2008-09-27 23:50:03 +09:00