Skip to content

Commit

Permalink
Merge pull request #178 from Sunbird-ALL/all-1.2-tn-dev
Browse files Browse the repository at this point in the history
All 1.2 tn dev
  • Loading branch information
gouravmore authored Oct 20, 2024
2 parents 76d28c0 + 700fd08 commit 577d45a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Layouts.jsx/MainLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ const MainLayout = (props) => {
/>
) : (
<img
src={correctImage}
src="https://raw.githubusercontent.com/Sunbird-ALL/all-learner-ai-app/refs/heads/all-1.2-tn-dev/src/assets/correct.svg"
alt="correctImage"
/>
)}
Expand Down
16 changes: 11 additions & 5 deletions src/components/Practice/Mechanics5.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Mechanics5 = ({
isDiscover,
header,
parentWords,
options,
options = {},
image,
question_audio,
handleNext,
Expand Down Expand Up @@ -63,7 +63,8 @@ const Mechanics5 = ({
const updateStoredData = (audios, isCorrect) => {
if (audios) {
const newEntry = {
selectedAnswer: options[selectedOption]?.text,
selectedAnswer:
options && options.length > 0 && options[selectedOption]?.text,
audioUrl: audios,
correctAnswer: isCorrect,
};
Expand Down Expand Up @@ -218,7 +219,7 @@ const Mechanics5 = ({
</span>
</Box>

{options.length &&
{options && options.length > 0 ? (
options.map((option, i) => (
<Box
key={option.audio_url}
Expand Down Expand Up @@ -262,10 +263,13 @@ const Mechanics5 = ({
marginLeft: "10px",
}}
>
{option.text}
{option?.text || "Text is missing"}
</span>
</Box>
))}
))
) : (
<div>No options available</div>
)}
</Grid>
</Grid>

Expand All @@ -279,6 +283,8 @@ const Mechanics5 = ({
storyLine={storyLine}
dontShowListen={type === "image" || isDiscover}
originalText={
options &&
options.length > 0 &&
options.find((option) => option.isAns === true).text
? options.find((option) => option.isAns === true).text
: parentWords
Expand Down
6 changes: 3 additions & 3 deletions src/views/Practice/Practice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ const Practice = () => {
setOpenMessageDialog,
options: questions[currentQuestion]?.mechanics_data
? questions[currentQuestion]?.mechanics_data[0]?.options
: null,
: [],
}}
/>
);
Expand Down Expand Up @@ -881,7 +881,7 @@ const Practice = () => {
} else if (mechanism.name === "readTheImage") {
const options = questions[currentQuestion]?.mechanics_data
? questions[currentQuestion]?.mechanics_data[0]?.options
: null;
: [];
const audioLink =
options && options.length > 0
? options.find((option) => option.isAns === true)?.audio_url || null
Expand Down Expand Up @@ -1059,7 +1059,7 @@ const Practice = () => {
setOpenMessageDialog,
options: questions[currentQuestion]?.mechanics_data
? questions[currentQuestion]?.mechanics_data[0]?.options
: null,
: [],
}}
/>
);
Expand Down

0 comments on commit 577d45a

Please sign in to comment.