Skip to content

Commit

Permalink
prefer new tunes for practice assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
hwellmann committed Jul 30, 2024
1 parent 2963d44 commit 737569c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/service/practice-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function randomized(date: Date): Date {
* and the required number of items is taken from the list for the current assignment.
*
* If the remaining sorted list contains any recent items (practiced not more than N times),
* the assignment starts with up to N/2 items from these recent ones and is filled up with
* this recent items list is sorted again by number of times practiced.
* The assignment starts with up to N/2 items from these recent ones and is filled up with
* items from the sorted due list.
*/
@Injectable()
Expand All @@ -52,6 +53,7 @@ export class PracticeService {
const remaining = assignment.slice(repertoire.numTunesPerAssignment + 1);
const remainingRecent = remaining.filter(item => item.timesPracticed <= INTERVALS.length);
if (remainingRecent.length > 0) {
remainingRecent.sort((left, right) => left.timesPracticed - right.timesPracticed);
const part1 = remainingRecent.slice(0, repertoire.numTunesPerAssignment/ 2);
const part2 = due.slice(0, repertoire.numTunesPerAssignment - part1.length);
return part1.concat(part2);
Expand Down

0 comments on commit 737569c

Please sign in to comment.