feat: basic chord trainer

fix: don't add chords from backup if identical chords already exist, fixes #30
This commit is contained in:
2023-11-18 18:35:59 +01:00
parent e84470d577
commit a0fe925ea9
6 changed files with 188 additions and 744 deletions

View File

@@ -109,7 +109,11 @@ export function restoreFromFile(
export function getChangesFromChordFile(file: CharaChordFile) {
const changes: Change[] = []
const existingChords = new Set(get(chords).map(({phrase, actions}) => JSON.stringify({phrase, actions})))
for (const [input, output] of file.chords) {
if (existingChords.has(JSON.stringify({actions: input, phrase: output}))) {
continue
}
changes.push({
type: ChangeType.Chord,
actions: input,