Skip to content

Commit 691d5ef

Browse files
authored
Merge pull request #38 from ishythefishy/theoretical-scale-bug-fix
bugfix(theoretical-scales): Construct full harmonic to compare with to prevent wrong co…
2 parents 05be7d4 + 2cf6615 commit 691d5ef

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

apps/fretonator-web/src/app/common/fretonator/scale-map/get-enharmonic-router-link.pipe.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ describe('GetEnharmonicRouterLinkPipe', () => {
1212
it('returns correctly for g sharp ionian', () => {
1313
expect(pipe.transform('g', 'sharp', 'ionian')).toStrictEqual(['/', 'a', 'flat', 'ionian']);
1414
});
15+
16+
it('returns correctly for g flat minorPentatonic', () => {
17+
expect(pipe.transform('g', 'flat', 'minorPentatonic')).toStrictEqual(['/', 'f', 'sharp', 'minorPentatonic']);
18+
});
1519
});

apps/fretonator-web/src/app/common/fretonator/scale-map/get-enharmonic-router-link.pipe.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ export class GetEnharmonicRouterLinkPipe implements PipeTransform {
1010
transform(note: string, noteExtenderString: string, mode: string): string[] {
1111
let newNote;
1212

13+
const extenderStringAsSymbol = noteExtenderString === 'sharp' ? '#' : '♭';
14+
const enharmonicItem = note.toUpperCase() + extenderStringAsSymbol;
15+
1316
for(const group of Enharmonics) {
14-
if (group[0].includes(note.toUpperCase())) {
17+
if (group[0] === enharmonicItem) {
1518
newNote = group[1].charAt(0).toLowerCase();
16-
}
17-
18-
if (group[1].includes(note.toUpperCase())) {
19+
} else if (group[1] === enharmonicItem) {
1920
newNote = group[0].charAt(0).toLowerCase();
2021
}
2122
}

0 commit comments

Comments
 (0)