Skip to content

Commit

Permalink
Merge pull request #323 from data-mermaid/pqt_transect_count_fix
Browse files Browse the repository at this point in the history
[hotfix] add pqt sample_unit_count to total transects calc
  • Loading branch information
gridcell authored Aug 9, 2024
2 parents a0d707c + 3342f49 commit f6f96f8
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions src/components/MermaidDash.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,21 +388,32 @@ class MermaidDash extends Component {

getTransectCount = sampleUnits => {
const sampleUnitCount = sampleUnits
.map(({ beltfish, benthicpit, benthiclit, habitatcomplexity, colonies_bleached }) => {
const beltfishCount = beltfish ? beltfish.sample_unit_count : 0
const benthicPitCount = benthicpit ? benthicpit.sample_unit_count : 0
const benthicLitCount = benthiclit ? benthiclit.sample_unit_count : 0
const habitatComplexityCount = habitatcomplexity ? habitatcomplexity.sample_unit_count : 0
const coloniesBleachedCount = colonies_bleached ? colonies_bleached.sample_unit_count : 0

return (
beltfishCount +
benthicPitCount +
benthicLitCount +
habitatComplexityCount +
coloniesBleachedCount
)
})
.map(
({
beltfish,
benthicpit,
benthiclit,
benthicpqt,
habitatcomplexity,
colonies_bleached,
}) => {
const beltfishCount = beltfish ? beltfish.sample_unit_count : 0
const benthicPitCount = benthicpit ? benthicpit.sample_unit_count : 0
const benthicLitCount = benthiclit ? benthiclit.sample_unit_count : 0
const benthicPqtCount = benthicpqt ? benthicpqt.sample_unit_count : 0
const habitatComplexityCount = habitatcomplexity ? habitatcomplexity.sample_unit_count : 0
const coloniesBleachedCount = colonies_bleached ? colonies_bleached.sample_unit_count : 0

return (
beltfishCount +
benthicPitCount +
benthicLitCount +
benthicPqtCount +
habitatComplexityCount +
coloniesBleachedCount
)
},
)
.reduce((acc, val) => acc + val, 0)

return sampleUnitCount
Expand Down

0 comments on commit f6f96f8

Please sign in to comment.