better song sorting
This commit is contained in:
@@ -5,6 +5,7 @@ import {Observable} from 'rxjs';
|
||||
import {filter, map, switchMap} from 'rxjs/operators';
|
||||
import {ShowSongService} from '../shows/services/show-song.service';
|
||||
import {GlobalSettings} from '../../services/global-settings';
|
||||
import {ShowService} from '../shows/services/show.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-guest',
|
||||
@@ -16,11 +17,16 @@ export class GuestComponent {
|
||||
filter(_ => !!_),
|
||||
map(_ => _ as GlobalSettings),
|
||||
map(_ => _.currentShow),
|
||||
switchMap(_ => this.showSongService.list$(_)),
|
||||
filter(_ => !!_),
|
||||
map(_ => _),
|
||||
map(_ => _.sort((x, y) => x.order - y.order).map(showSong => showSong.text))
|
||||
switchMap(_ => this.showSongService.list$(_).pipe(map(l => ({showSongs: l, currentShow: _})))),
|
||||
switchMap(_ => this.showService.read$(_.currentShow).pipe(map(l => ({showSongs: _.showSongs, show: l})))),
|
||||
filter(_ => !!_.showSongs),
|
||||
map(_ => (_?.show ? _.show.order.map(o => _.showSongs.find(f => f.id === o) ?? _.showSongs[0]).map(m => m.text) : []))
|
||||
);
|
||||
|
||||
public constructor(private songService: SongService, private globalSettingsService: GlobalSettingsService, private showSongService: ShowSongService) {}
|
||||
public constructor(
|
||||
private songService: SongService,
|
||||
private showService: ShowService,
|
||||
private globalSettingsService: GlobalSettingsService,
|
||||
private showSongService: ShowSongService
|
||||
) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user