@@ -172,8 +172,8 @@ Currently logged-in as ${this._username}.`
172172 const id = row . id ;
173173 // Delete user progress data but preserve core user documents
174174 return (
175- id . startsWith ( cardHistoryPrefix ) || // Card interaction history
176- id . startsWith ( REVIEW_PREFIX ) || // Scheduled reviews
175+ id . startsWith ( DocTypePrefixes [ DocType . CARDRECORD ] ) || // Card interaction history
176+ id . startsWith ( DocTypePrefixes [ DocType . SCHEDULED_CARD ] ) || // Scheduled reviews
177177 id === BaseUser . DOC_IDS . COURSE_REGISTRATIONS || // Course registrations
178178 id === BaseUser . DOC_IDS . CLASSROOM_REGISTRATIONS || // Classroom registrations
179179 id === BaseUser . DOC_IDS . CONFIG // User config
@@ -372,8 +372,11 @@ Currently logged-in as ${this._username}.`
372372 ) ;
373373 return reviews . rows
374374 . filter ( ( r ) => {
375- if ( r . id . startsWith ( REVIEW_PREFIX ) ) {
376- const date = moment . utc ( r . id . substr ( REVIEW_PREFIX . length ) , REVIEW_TIME_FORMAT ) ;
375+ if ( r . id . startsWith ( DocTypePrefixes [ DocType . SCHEDULED_CARD ] ) ) {
376+ const date = moment . utc (
377+ r . id . substr ( DocTypePrefixes [ DocType . SCHEDULED_CARD ] . length ) ,
378+ REVIEW_TIME_FORMAT
379+ ) ;
377380 if ( targetDate . isAfter ( date ) ) {
378381 if ( course_id === undefined || r . doc ! . courseId === course_id ) {
379382 return true ;
@@ -814,7 +817,7 @@ Currently logged-in as ${this._username}.`
814817 * @param course_id optional specification of individual course
815818 */
816819 async getSeenCards ( course_id ?: string ) {
817- let prefix = cardHistoryPrefix ;
820+ let prefix = DocTypePrefixes [ DocType . CARDRECORD ] ;
818821 if ( course_id ) {
819822 prefix += course_id ;
820823 }
@@ -824,8 +827,8 @@ Currently logged-in as ${this._username}.`
824827 // const docs = await this.localDB.allDocs({});
825828 const ret : PouchDB . Core . DocumentId [ ] = [ ] ;
826829 docs . rows . forEach ( ( row ) => {
827- if ( row . id . startsWith ( cardHistoryPrefix ) ) {
828- ret . push ( row . id . substr ( cardHistoryPrefix . length ) ) ;
830+ if ( row . id . startsWith ( DocTypePrefixes [ DocType . CARDRECORD ] ) ) {
831+ ret . push ( row . id . substr ( DocTypePrefixes [ DocType . CARDRECORD ] . length ) ) ;
829832 }
830833 } ) ;
831834 return ret ;
@@ -838,7 +841,7 @@ Currently logged-in as ${this._username}.`
838841 async getHistory ( ) {
839842 const cards = await filterAllDocsByPrefix < CardHistory < CardRecord > > (
840843 this . remoteDB ,
841- cardHistoryPrefix ,
844+ DocTypePrefixes [ DocType . CARDRECORD ] ,
842845 {
843846 include_docs : true ,
844847 attachments : false ,
0 commit comments