mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-20 00:43:04 +00:00
feat: basic chord trainer
fix: don't add chords from backup if identical chords already exist, fixes #30
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user