-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fixture): Remove fixture from scene and venue
When deleting a fixture, it will now also be removed from the related scenes and venues. fix #83
- Loading branch information
1 parent
02ea464
commit 5ce5d6f
Showing
3 changed files
with
68 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createSelector } from 'reselect/src/index.js' | ||
|
||
export const getVenues = state => state.venueManager | ||
|
||
/* | ||
* Get a specific fixture by using the fixtureId | ||
*/ | ||
export const getVenue = (state, properties) => { | ||
return getVenues(state) | ||
.filter(venue => venue.id === properties.venueId)[0] | ||
} | ||
|
||
/* | ||
* Sort venues by venue.name | ||
*/ | ||
export const getVenuesSorted = createSelector( | ||
getVenues, | ||
venues => venues.sort((a, b) => collator.compare(a.name, b.name)) | ||
) | ||
|
||
/* | ||
* Get venues that contain a specific fixture | ||
*/ | ||
export const getVenuesWithFixture = (state, properties) => { | ||
return getVenues(state) | ||
.filter(venue => { | ||
return venue.slots.filter(slot => slot.fixtures.includes(properties.fixtureId)) | ||
}) | ||
} | ||
|
||
/* | ||
* Get venues that contain a specific fixture | ||
*/ | ||
export const getVenueSlotsWithFixture = (state, properties) => { | ||
return getVenues(state) | ||
.filter(venue => { | ||
return venue.slots.filter(slot => slot.fixtures.includes(properties.fixtureId)) | ||
}) | ||
.map(venue => venue.slots) | ||
.filter(slot => slot.fixtures.includes(properties.fixtureId)) | ||
} |