Commit 926dfc5d authored by kulvinu's avatar kulvinu

Minor bug fixes

parent c82cb6a9
import difflib
import re
colourNumbers = [ "3","21","38","148"]
colourNumbers = [ "3", "21", "29", "83", "184", "2567", "15684"]
digitSpan = [ "27","386","6251","86237", "382157"]
digitSpan = [ "27", "386", "6251", "86237", "382157"]
def calKnowledgeIqActivityScore(activity, questionIndex, prediction):
questionIndex = int(questionIndex)
......@@ -11,7 +11,7 @@ def calKnowledgeIqActivityScore(activity, questionIndex, prediction):
string2 = re.findall('\d+', string1)
prediction = "".join(string2).replace(" ", "")
cal_score = []
if (activity == "CN"):
if (activity == "Colour Numbers"):
if (colourNumbers[questionIndex-1] == prediction):
score = 100
......@@ -21,11 +21,11 @@ def calKnowledgeIqActivityScore(activity, questionIndex, prediction):
temp = difflib.SequenceMatcher(None, colourNumbers[questionIndex-1], prediction)
print(temp.get_matching_blocks())
print('Similarity Score: ',temp.ratio())
print('Similarity Score: ', temp.ratio())
cal_score = [score, temp.ratio()*100, colourNumbers[questionIndex-1]]
cal_score = [score, temp.ratio()*100, colourNumbers[questionIndex-1], string2]
elif (activity == "DS"):
elif (activity == "Digit Span"):
if (digitSpan[questionIndex-1] == prediction):
score = 100
......@@ -37,7 +37,7 @@ def calKnowledgeIqActivityScore(activity, questionIndex, prediction):
print(temp.get_matching_blocks())
print('Similarity Score: ',temp.ratio())
cal_score = [score, temp.ratio()*100, digitSpan[questionIndex-1]]
cal_score = [score, temp.ratio()*100, digitSpan[questionIndex-1], string2]
else:
cal_score = []
......
......@@ -482,7 +482,8 @@ def predictKnowledgeIq():
"transcription": prediction,
"accuracyScore": score[0],
"similarityScore": score[1],
"expectedAnswer": score[2]
"expectedAnswer": score[2],
"refinedTranscript": score[3]
})
return jsonify(data)
except:
......
......@@ -3,9 +3,7 @@ import "./ActivityContainer.css";
import {
PictureConcept,
Arithmetic,
ColourNumbers,
ColourNumbersController,
DigitSpan,
DigitSpanController,
VideoPlayerScreen,
} from "../index";
......
......@@ -10,11 +10,6 @@ const AudioPlayerScreen = ({ currentActivtyIndex, changeScreen }) => {
<div id=" w-full h-full bg-white">
<ContainerCard>
<div>
<div >
<h2 className="text-base text-[#3d59c1] font-semibold tracking-wide uppercase mt-4">
Digit Span
</h2>
</div>
<div className="mt-10 sm:mt-0">
<Audio
currentActivtyIndex={currentActivtyIndex}
......
.new{
padding-top: 16%;
padding-bottom: 16%;
background-color: white;
}
.digitCard:hover {
......
import React, {useState, useEffect, memo} from "react";
import Grid from "@mui/material/Grid";
import Paper from "@mui/material/Paper";
import Box from "@mui/material/Box";
import React, {useEffect, memo} from "react";
import "./ColourNumbers.css";
import { lightBlue, yellow } from "@mui/material/colors";
import { createTheme, ThemeProvider, styled } from "@mui/material/styles";
import { RecordingHandler } from "../recorder/Recorder";
import Timer from "../timer/Timer";
import { useRef } from "react";
const Item = styled(Paper)(({ theme }) => ({
textAlign: "center",
color: theme.palette.text.primary,
height: 60,
lineHeight: "60px",
textDecorationColor: "black",
fontWeight: "Bold",
}));
const ColourNumbers = ({ GoNext, isAllCompleted }) => {
// const [isAllCompleted, setAllCompleted] = useState(false);
const [activityIndex, setActivityIndex] = useState(1);
const effectRan = useRef(false);
// const switchActivityHandler = () => {
// let activityNo = activityIndex + 1;
// setActivityIndex(activityNo);
// // switch question
// console.log('switch');
// };
useEffect(() => {
console.log('rec');
if(effectRan.current === false){
RecordingHandler(`CN.wav`, activityIndex, 'CN');
return () => {
console.log("unmounted");
effectRan.current = true;
const ColourNumbers = ({ GoNext, isAllCompleted, currentActivityNo }) => {
const effectRan = useRef(false);
useEffect(() => {
if(effectRan.current === false){
RecordingHandler(`CN.wav`, currentActivityNo, 'Colour Numbers');
return () => {
effectRan.current = true;
}
}
}
}, [activityIndex]);
}, [currentActivityNo]);
return (
<div className="new">
......
......@@ -4,7 +4,7 @@ import { ColourNumbers } from "../../..";
import VideoPlayerScreen from "./videoPlayer";
const ColourNumbersController = ({nextActivity}) => {
const activityCount = 4;
const activityCount = 7;
const [currentActivityNo, setCurrentActivityNo] = useState(1);
const [isAudioCompleted, setIsAudioCompleted] = useState(false);
const [isAllCompleted, setIsAllCompleted] = useState(false);
......
import React, { useState, useEffect, useRef } from "react";
import CN1 from "../../../../assets/video/CN-3.mp4";
import CN2 from "../../../../assets/video/CN-2-1.mp4";
import CN3 from "../../../../assets/video/CN-3-8.mp4";
import CN4 from "../../../../assets/video/CN-1-4-8.mp4";
import CN3 from "../../../../assets/video/CN-9-2.mp4";
import CN4 from "../../../../assets/video/CN-3-8.mp4";
import CN5 from "../../../../assets/video/CN-1-4-8.mp4";
import CN6 from "../../../../assets/video/CN-7-6-5-2.mp4";
import CN7 from "../../../../assets/video/CN-6-1-4-5-8.mp4";
const Video = ({ currentActivtyIndex, changeScreen }) => {
const [videoLink, setVideoLink] = useState("");
......@@ -23,7 +26,13 @@ const Video = ({ currentActivtyIndex, changeScreen }) => {
setVideoLink(CN4);
break;
case 5:
setVideoLink("/Videos/vid1.mp4");
setVideoLink(CN5);
break;
case 6:
setVideoLink(CN6);
break;
case 7:
setVideoLink(CN7);
break;
default:
}
......
......@@ -3,6 +3,7 @@
position: relative;
height: 100%;
width: 100%;
background-color: white;
}
.new{
......@@ -10,7 +11,7 @@
padding-bottom: 16%;
}
/* img{
height: 350px;
img{
height: 450px;
width: auto;
} */
\ No newline at end of file
}
\ No newline at end of file
import React, { useState, useEffect, memo, useRef } from "react";
import { green, red } from "@mui/material/colors";
import Avatar from "@mui/material/Avatar";
import React, { useEffect, memo, useRef } from "react";
import Stack from "@mui/material/Stack";
import MicSharpIcon from "@mui/icons-material/MicSharp";
import MicOffSharpIcon from "@mui/icons-material/MicOffSharp";
import VolumeUpIcon from "@mui/icons-material/VolumeUp";
import VolumeOffIcon from "@mui/icons-material/VolumeOff";
// import Picture from "./teacherDS.gif";
import Button from "@mui/material/Button";
import Timer from "../timer/Timer";
import { RecordingHandler } from "../recorder/Recorder";
import "./DigitSpan.css";
const DigitSpan = ({ GoNext, isAllCompleted, currentActivityNo }) => {
const [activityIndex, setActivityIndex] = useState(1);
const effectRan = useRef(false);
useEffect(() => {
console.log("rec");
if(effectRan.current === false) {
RecordingHandler(`DS.wav`, currentActivityNo, 'DS');
RecordingHandler(`DS.wav`, currentActivityNo, 'Digit Span');
return () => {
console.log("unmounted");
effectRan.current = true;
}
}
......@@ -50,13 +40,6 @@ const DigitSpan = ({ GoNext, isAllCompleted, currentActivityNo }) => {
>
{!isAllCompleted && <Timer switchActivity={GoNext} />}
</Stack>
{/* <Button
onClick={() => {
nextActivity();
}}
>
Next
</Button> */}
</div>
);
};
......
......@@ -22,10 +22,10 @@ const Video = ({ currentActivtyIndex, changeScreen }) => {
setVideoLink("/Videos/vid5.mp4");
break;
case 6:
setVideoLink("/Videos/vid2.mp4");
setVideoLink("/Videos/vid6.mp4");
break;
case 7:
setVideoLink("/Videos/vid3.mp4");
setVideoLink("/Videos/vid7.mp4");
break;
case 8:
setVideoLink("/Videos/vid4.mp4");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment