Skip to content

Commit

Permalink
found a logic error in an extreme case. It has been fixed and now bea…
Browse files Browse the repository at this point in the history
…utifying the slider.
  • Loading branch information
aldoeve committed Jan 31, 2025
1 parent fc1d68c commit 95cad14
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions FrontEndReact/src/View/Admin/View/CompleteAssessmentTask/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class Form extends Component {
this.setState({
hideUnits: event.target.checked
})
if(event.target.checked){
if(event.target.checked && this.state.consistentValidUnit !== null){
this.handleUnitTabChange(this.state.consistentValidUnit);
}
};
Expand All @@ -327,6 +327,20 @@ class Form extends Component {
}
return null;
};

/**
* @method shouldTabsCategoriesRender - Prevents rendering tabs if TA view has all tabs hidden.
*
* @param {object} - What is supposed to be rendered.
*/
this.shouldTabsCategoriesRender = (renderObject) => {
const {hideUnits, consistentValidUnit} = this.state;
const tabToDefualtTo = consistentValidUnit !== null;
return (
( (hideUnits && tabToDefualtTo) || (!hideUnits) )
&& renderObject
);
};
};

componentDidMount() {
Expand All @@ -348,7 +362,7 @@ class Form extends Component {
}else{
this.generateCategoriesAndSection();
};
if(!this.props.usingTeams){
if(this.props.usingTeams){
this.setState({
consistentValidUnit: this.findPersistantTab(),
});
Expand All @@ -370,7 +384,6 @@ class Form extends Component {


{ this.props.usingTeams && this.props.roleName === "TA/Instructor" &&
//Modify the using teams when the other stuff gets pushed
<FormGroup sx={{ marginTop: "-0.50rem" }}>
<FormControlLabel
control={
Expand Down Expand Up @@ -448,12 +461,12 @@ class Form extends Component {
},
}}
>
{this.state.consistentValidUnit !== null && this.state.categoryList}
{this.shouldTabsCategoriesRender(this.state.categoryList)}
</Tabs>
</Box>
</Box>

{this.state.consistentValidUnit !== null && this.state.section}
{this.shouldTabsCategoriesRender(this.state.section)}
</Box>
)
}
Expand Down

0 comments on commit 95cad14

Please sign in to comment.