Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: No class average if it is not known #355

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/views/account/Grades/Graph/GradesAverage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ const GradesAverageGraph: React.FC<GradesAverageGraphProps> = ({
}}
activeScale={0.975}
weight="light"
onPress={() => setShowDetails(!showDetails)}
onPress={() => {
if (classAvg !== 0) {
setShowDetails(!showDetails);
}}}
>
{hLength > 0 && (
<NativeList animated>
Expand Down Expand Up @@ -230,13 +233,19 @@ const GradesAverageGraph: React.FC<GradesAverageGraphProps> = ({
style={[styles.gradeValue]}
layout={animPapillon(LinearTransition)}
>
<AnimatedNumber
value={classAvg.toFixed(2)}
style={styles.gradeNumberClass}
/>
<Reanimated.View layout={animPapillon(LinearTransition)}>
<NativeText style={[styles.gradeOutOf]}>/20</NativeText>
</Reanimated.View>
{classAvg === 0 ? (
<NativeText style={styles.gradeNumberClass}>Inconnue</NativeText>
) : (
<>
<AnimatedNumber
value={classAvg.toFixed(2)}
style={styles.gradeNumberClass}
/>
<Reanimated.View layout={animPapillon(LinearTransition)}>
<NativeText style={[styles.gradeOutOf]}>/20</NativeText>
</Reanimated.View>
</>
)}
</Reanimated.View>
</View>
</Reanimated.View>
Expand Down
Loading