Updated the radial result accordingly

This commit is contained in:
Tiago Ribeiro
2024-03-23 18:28:12 +00:00
parent 18df890ef9
commit bd74313bd5

View File

@@ -5,13 +5,16 @@ import {View, Text, Image} from "@react-pdf/renderer";
import {styles} from "../styles"; import {styles} from "../styles";
import {ModuleScore} from "@/interfaces/module.scores"; import {ModuleScore} from "@/interfaces/module.scores";
import {calculateBandScore} from "@/utils/score"; import {calculateBandScore} from "@/utils/score";
import {Module} from "@/interfaces";
export const RadialResult = ({module, score, total, png}: ModuleScore) => ( export const RadialResult = ({module, score, total, png}: ModuleScore) => (
<View style={[styles.textFont, styles.radialContainer]}> <View style={[styles.textFont, styles.radialContainer]}>
<Text style={[styles.textColor, styles.textBold, {fontSize: 10}]}>{module}</Text> <Text style={[styles.textColor, styles.textBold, {fontSize: 10}]}>{module}</Text>
<Image src={png} style={styles.image64}></Image> <Image src={png} style={styles.image64}></Image>
<View style={[styles.textColor, styles.radialResultContainer]}> <View style={[styles.textColor, styles.radialResultContainer]}>
<Text style={styles.textBold}>{calculateBandScore(score, total, module, "academic")}</Text> <Text style={styles.textBold}>
{module === "level" ? Math.floor(score) : calculateBandScore(score, total, module.toLowerCase() as Module | "overall", "general")}
</Text>
<Text style={{fontSize: 8}}>out of 9.0</Text> <Text style={{fontSize: 8}}>out of 9.0</Text>
</View> </View>
</View> </View>