Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[breakdown] Fix asset type filtering #1549

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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