Skip to content

Commit

Permalink
Merge pull request #319 from data-mermaid/M666
Browse files Browse the repository at this point in the history
[E666] add bleaching % hard cover to histogram totals
  • Loading branch information
saanobhaai authored May 1, 2024
2 parents c0e67d4 + 382bf88 commit 09dc625
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/MermaidDash.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,25 +407,29 @@ class MermaidDash extends Component {
}

getSampleEventBenthicHardCoralAverages = sampleUnits => {
return sampleUnits.map(({ benthiclit, benthicpit, benthicpqt }) => {
return sampleUnits.map(({ benthiclit, benthicpit, benthicpqt, quadrat_benthic_percent }) => {
const benthicLITCover = benthiclit && benthiclit.percent_cover_benthic_category_avg
const benthicPITCover = benthicpit && benthicpit.percent_cover_benthic_category_avg
const benthicPQTCover = benthicpqt && benthicpqt.percent_cover_benthic_category_avg
const benthicBQCHardCoral =
quadrat_benthic_percent && quadrat_benthic_percent.percent_hard_avg_avg

if (benthicLITCover || benthicPITCover || benthicPQTCover) {
if (benthicLITCover || benthicPITCover || benthicPQTCover || benthicBQCHardCoral) {
const benthicLITHardCoral = benthicLITCover && benthicLITCover['Hard coral']
const benthicPITHardCoral = benthicPITCover && benthicPITCover['Hard coral']
const benthicPQTHardCoral = benthicPQTCover && benthicPQTCover['Hard coral']

const numerator =
(benthicLITHardCoral !== undefined ? benthicLITHardCoral : 0) +
(benthicPITHardCoral !== undefined ? benthicPITHardCoral : 0) +
(benthicPQTHardCoral !== undefined ? benthicPQTHardCoral : 0)
(benthicPQTHardCoral !== undefined ? benthicPQTHardCoral : 0) +
(benthicBQCHardCoral !== undefined ? benthicBQCHardCoral : 0)

const denominator =
(benthicLITHardCoral !== undefined ? 1 : 0) +
(benthicPITHardCoral !== undefined ? 1 : 0) +
(benthicPQTHardCoral !== undefined ? 1 : 0)
(benthicPQTHardCoral !== undefined ? 1 : 0) +
(benthicBQCHardCoral !== undefined ? 1 : 0)

return numerator / denominator
}
Expand Down

0 comments on commit 09dc625

Please sign in to comment.