bugfixing

This commit is contained in:
2020-06-14 15:46:24 +02:00
parent 1e1e127f13
commit 19b28453d3
36 changed files with 175 additions and 97 deletions

View File

@@ -86,11 +86,11 @@ export class DocxService {
},
]
}
})
});
}
private renderSongs(songs: { showSong: ShowSong; song: Song; sections: Section[] }[], options: DownloadOptions, config: Config): Paragraph[] {
return songs.reduce((p, song) => [...p, ...this.renderSong(song.showSong, song.song, song.sections, options, config)], [])
return songs.reduce((p, song) => [...p, ...this.renderSong(song.showSong, song.song, song.sections, options, config)], []);
}
private renderSong(showSong: ShowSong, song: Song, sections: Section[], options: DownloadOptions, config: Config): Paragraph[] {
@@ -121,7 +121,9 @@ export class DocxService {
}
private renderCopyright(song: Song, options: DownloadOptions, config: Config): Paragraph {
if (!options?.copyright) return null;
if (!options?.copyright) {
return null;
}
const label = song.label ? song.label + ', ' : '';
const artist = song.artist ? song.artist + ', ' : '';
@@ -141,7 +143,9 @@ export class DocxService {
private renderSection(section: Section, chordMode: ChordMode): Paragraph[] {
return section.lines
.filter(line => {
if (line.type === LineType.text) return true;
if (line.type === LineType.text) {
return true;
}
switch (chordMode) {
case 'show':
return true;
@@ -172,7 +176,7 @@ export class DocxService {
thematicBreak: true,
});
return [songTitle]
return [songTitle];
}
private async prepareData(showId: string): Promise<{ songs: ({ showSong: ShowSong, song: Song, sections: Section[] })[]; show: Show, user: User, config: Config }> {
@@ -191,8 +195,8 @@ export class DocxService {
showSong,
song,
sections
}
})
};
});
const songs = await Promise.all(songsAsync);
return {songs, show, user, config};
}
@@ -213,5 +217,5 @@ export class DocxService {
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}, 1000);
};
}
}

View File

@@ -15,5 +15,5 @@ export class ShowDataService {
public list$ = (queryFn?): Observable<Show[]> => this.dbService.col$(this.collection, queryFn);
public read$ = (showId: string): Observable<Show | undefined> => this.dbService.doc$(`${this.collection}/${showId}`);
public update = async (showId: string, data: Partial<Show>): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}`).update(data);
public add = async (data: Partial<Show>): Promise<string> => (await this.dbService.col(this.collection).add(data)).id
public add = async (data: Partial<Show>): Promise<string> => (await this.dbService.col(this.collection).add(data)).id;
}

View File

@@ -17,5 +17,5 @@ export class ShowSongDataService {
public read$ = (showId: string, songId: string): Observable<ShowSong | undefined> => this.dbService.doc$(`${this.collection}/${showId}/${this.subCollection}/${songId}`);
public update$ = async (showId: string, songId: string, data: Partial<ShowSong>): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}/${this.subCollection}/${songId}`).update(data);
public delete = async (showId: string, songId: string): Promise<void> => await this.dbService.doc(`${this.collection}/${showId}/${this.subCollection}/${songId}`).delete();
public add = async (showId: string, data: Partial<ShowSong>): Promise<string> => (await this.dbService.col(`${this.collection}/${showId}/${this.subCollection}`).add(data)).id
public add = async (showId: string, data: Partial<ShowSong>): Promise<string> => (await this.dbService.col(`${this.collection}/${showId}/${this.subCollection}`).add(data)).id;
}

View File

@@ -30,7 +30,7 @@ export class ShowService {
.filter(_ => !_.archived)
.filter(show => show.published || (show.owner === _.user.id && !publishedOnly))
)
)
);
}