Skip to content

Commit

Permalink
Removing intermediate smart stack check
Browse files Browse the repository at this point in the history
since the backend now does not send intermediate smart stacks this code
is no longer needed and can be removed.
  • Loading branch information
LTDakin committed Nov 28, 2023
1 parent bd608ab commit 64615f7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion src/components/sitepages/SiteData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/>
<thumbnail-row
class="data-thumbs"
:images="$store.getters['images/recent_images_condensed']"
:images="$store.getters['images/recent_images']"
:selected_image="current_image.image_id"
@thumbnailClicked="setActiveImage"
/>
Expand Down
23 changes: 0 additions & 23 deletions src/store/modules/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,6 @@ const getters = {
current_image: state => state.current_image,
recent_images: state => state.recent_images,
user_images: state => state.user_images,
// Uses recent_images but removes any intermediate smartstack frames, so you only see the latest version of each smart stack
recent_images_condensed: state => {
// First, generate a map of maximum SSTKNUM for each SMARTSTK
const maxSSTKNUMs = state.recent_images.reduce((acc, cur) => {
if (!cur.SMARTSTK || !cur.SSTKNUM) return acc // Skip if missing SMARTSTK or SSTKNUM

const num = parseInt(cur.SSTKNUM) // convert string to number
if (!acc[cur.SMARTSTK] || num > acc[cur.SMARTSTK]) {
acc[cur.SMARTSTK] = num
}
return acc
}, {})

// Now, filter the original array
const filteredArr = state.recent_images.filter(el => {
// Keep if missing SMARTSTK or SSTKNUM
if (!el.SMARTSTK || !el.SSTKNUM) return true

// Keep if SSTKNUM is the maximum for its SMARTSTK
return el.SSTKNUM >= maxSSTKNUMs[el.SMARTSTK]
})
return filteredArr
},
show_user_data_only: state => state.show_user_data_only,

current_image_fits_header: state => state.current_image.fits_header,
Expand Down

0 comments on commit 64615f7

Please sign in to comment.