Skip to content

Commit

Permalink
Merge pull request #1549 from EvanBldy/master
Browse files Browse the repository at this point in the history
[breakdown] Fix asset type filtering
  • Loading branch information
frankrousseau authored Sep 30, 2024
2 parents 2319302 + 3bfee21 commit 29881ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/components/pages/Breakdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,11 @@ export default {
} else if (this.isShotCasting) {
return this.castingSequenceShots
} else {
if (this.isTVShow && this.currentEpisode.id !== 'main') {
if (
this.isTVShow &&
this.currentEpisode &&
this.currentEpisode.id !== 'main'
) {
return this.castingAssetTypeAssets.filter(
asset =>
asset.episode_id === this.currentEpisode.id ||
Expand Down Expand Up @@ -1097,7 +1101,7 @@ export default {
}
}
} else if (this.isAssetCasting) {
const assetTypeId = this.$route.params.asset_type_id
const assetTypeId = this.$route.params.asset_type_id || ''
if (assetTypeId !== this.assetTypeId) {
isChange = true
route = {
Expand Down
8 changes: 5 additions & 3 deletions src/store/modules/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ const helpers = {
let timeSpent = 0
let estimation = 0
if (!assetTypeMap.get(asset.asset_type)) {
assetTypeMap.set(asset.asset_type_id, {
id: asset.asset_type_id,
const assetTypeId = asset.asset_type_id || asset.entity_type_id
const assetType = {
id: assetTypeId,
name: asset.asset_type_name
})
}
assetTypeMap.set(assetTypeId, assetType)
}
asset.production_id = production.id
asset.project_name = production.name
Expand Down
8 changes: 6 additions & 2 deletions src/store/modules/breakdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ const actions = {
}
const production = rootState.productions.currentProduction
const assets = Array.from(rootState.assets.assetMap.values())
.filter(asset => asset.asset_type_id === assetTypeId)
.filter(asset => {
return (
asset.asset_type_id === assetTypeId ||
asset.entity_type_id === assetTypeId
)
})
.sort((a, b) =>
a.name.localeCompare(b.name, undefined, { numeric: true })
)
Expand Down Expand Up @@ -368,7 +373,6 @@ const mutations = {
},

[CASTING_SET_EPISODES](state, { production, episodes }) {
// TODO CASTING must be renamed to BREAKDOWN when used for namespacing, and CASTING must be kept for meaningful mutations
state.castingEpisodes = episodes
state.castingEpisodeOptions = episodes.map(production => {
const route = {
Expand Down

0 comments on commit 29881ca

Please sign in to comment.