Updated the condition to close assignment: to be end date or when all students finish the assignment
This commit is contained in:
@@ -151,8 +151,9 @@ export default function TeacherDashboard({user}: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const AssignmentsPage = () => {
|
const AssignmentsPage = () => {
|
||||||
const activeFilter = (a: Assignment) => moment(a.endDate).isAfter(moment()) && moment(a.startDate).isBefore(moment());
|
const activeFilter = (a: Assignment) =>
|
||||||
const pastFilter = (a: Assignment) => moment(a.endDate).isBefore(moment());
|
moment(a.endDate).isAfter(moment()) && moment(a.startDate).isBefore(moment()) && a.assignees.length > a.results.length;
|
||||||
|
const pastFilter = (a: Assignment) => moment(a.endDate).isBefore(moment()) || a.assignees.length === a.results.length;
|
||||||
const futureFilter = (a: Assignment) => moment(a.startDate).isAfter(moment());
|
const futureFilter = (a: Assignment) => moment(a.startDate).isAfter(moment());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,24 +1,17 @@
|
|||||||
/* eslint-disable jsx-a11y/alt-text */
|
/* eslint-disable jsx-a11y/alt-text */
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { View, Text, Image } from "@react-pdf/renderer";
|
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";
|
||||||
|
|
||||||
export const RadialResult = ({
|
export const RadialResult = ({module, score, total, png}: ModuleScore) => (
|
||||||
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 }]}>
|
<Text style={[styles.textColor, styles.textBold, {fontSize: 10}]}>{module}</Text>
|
||||||
{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}>{score}</Text>
|
<Text style={styles.textBold}>{score.toFixed(2)}</Text>
|
||||||
<Text style={{ fontSize: 8 }}>out of {total}</Text>
|
<Text style={{fontSize: 8}}>out of {total}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { View, StyleSheet } from "@react-pdf/renderer";
|
import {View, StyleSheet} from "@react-pdf/renderer";
|
||||||
import { ModuleScore } from "@/interfaces/module.scores";
|
import {ModuleScore} from "@/interfaces/module.scores";
|
||||||
import { RadialResult } from "./radial.result";
|
import {RadialResult} from "./radial.result";
|
||||||
interface Props {
|
interface Props {
|
||||||
testDetails: ModuleScore[];
|
testDetails: ModuleScore[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const customStyles = StyleSheet.create({
|
const customStyles = StyleSheet.create({
|
||||||
container: { display: "flex", flexDirection: "row", gap: 30 },
|
container: {display: "flex", flexDirection: "row", gap: 30},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const SkillExamDetails = ({ testDetails }: Props) => (
|
export const SkillExamDetails = ({testDetails}: Props) => (
|
||||||
<View style={customStyles.container}>
|
<View style={customStyles.container}>
|
||||||
{testDetails.map((detail) => {
|
{testDetails.map((detail) => {
|
||||||
const { module } = detail;
|
const {module} = detail;
|
||||||
return <RadialResult key={module} {...detail} />;
|
return <RadialResult key={module} {...detail} />;
|
||||||
})}
|
})}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export interface ModuleScore {
|
|||||||
score: number;
|
score: number;
|
||||||
total: number;
|
total: number;
|
||||||
code: Module;
|
code: Module;
|
||||||
module: Module | 'Overall';
|
module: Module | "Overall";
|
||||||
png?: string,
|
png?: string;
|
||||||
evaluation?: string,
|
evaluation?: string;
|
||||||
suggestions?: string,
|
suggestions?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StudentData {
|
export interface StudentData {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
@@ -19,4 +19,4 @@ export interface ModuleScore {
|
|||||||
result: string;
|
result: string;
|
||||||
level?: string;
|
level?: string;
|
||||||
bandScore: number;
|
bandScore: number;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user