diff --git a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx index b534e3214c..9bf1559368 100644 --- a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx +++ b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx @@ -92,6 +92,8 @@ const TrainingModules = createReactClass({ /> )); + if (!modules.length) { return null; } + const header = this.props.header || 'Training'; const headerId = header.toLowerCase().split(/[^a-z]/).join('-'); return ( diff --git a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx index d314651a35..ffd7dcbca3 100644 --- a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx +++ b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx @@ -21,6 +21,9 @@ const TrainingModulesViewMode = createReactClass({ const block = this.props.block; const modules = []; const length = block.training_modules.length; + + if (!length) { return null; } + const partitioned = block.training_modules.reduce((acc, mod) => { let key = 'modules'; if (mod.kind === EXERCISE_KIND) key = 'exercises';