Skip to content

Commit

Permalink
Merge pull request #157 from upendraTekdi/shiksha-2.0
Browse files Browse the repository at this point in the history
Issue #PS-314 feat: solved tsx issue for build
  • Loading branch information
itsvick authored May 24, 2024
2 parents 901cdae + 93f54f5 commit ad19ddd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
12 changes: 4 additions & 8 deletions src/components/learner-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ import { useRouter } from 'next/router';
import { useParams, usePathname } from 'next/navigation';
import { getUserDetails } from '@/services/ProfileService';
import { UserData, updateCustomField } from '@/utils/Interfaces';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';

const LearnerDetails = () => {
// const { t } = useTranslation();
const router = useRouter();
const pathname = usePathname();
const router = useRouter();
const { userId } = router.query;

const [open, setOpen] = React.useState(true);
const [userData, setUserData] = React.useState<UserData | null>(null);
Expand Down Expand Up @@ -80,13 +82,7 @@ const LearnerDetails = () => {
const theme = useTheme<any>();
const isDesktop = useMediaQuery(theme.breakpoints.up('md'));

const handleGoFullProfile = () => {
if (pathname !== `/learner-profile/${user}`) {
router.push(`/learner-profile/${user}`);
}
};

const labelValueArray = customFieldsData?.map(({ label, value }) => ({
const labelValueArray = customFieldsData.map(({ label, value }) => ({
label,
value,
}));
Expand Down
32 changes: 18 additions & 14 deletions src/pages/learner-profile/[userId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { useTheme, Theme } from '@mui/material/styles';

import { useTranslation } from 'next-i18next';
import { UserData, updateCustomField } from '../utils/Interfaces';
// import { UserData, updateCustomField } from '../utils/Interfaces';

// import Header from '../components/Header';
// import { formatDate, getTodayDate } from '../utils/Helper';
Expand All @@ -51,6 +51,7 @@ import { useRouter } from 'next/router';
import Header from '@/components/Header';
import { formatDate, getTodayDate } from '@/utils/Helper';
import { GetStaticPaths } from 'next';
import { UserData, updateCustomField } from '@/utils/Interfaces';

const LearnerProfile: React.FC = () => {
const { t } = useTranslation();
Expand All @@ -77,6 +78,7 @@ const LearnerProfile: React.FC = () => {
const [customFieldsData, setCustomFieldsData] = useState<updateCustomField[]>(
[]
);
const [submittedOn, setSubmitedOn] = useState();

const open = Boolean(anchorEl);
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
Expand All @@ -91,12 +93,12 @@ const LearnerProfile: React.FC = () => {
const handleOpenEdit = () => setOpenEdit(true);
const handleCloseEdit = () => setOpenEdit(false);

const handleListItemClick = (
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
index: number
) => {
setSelectedIndex(index);
};
// const handleListItemClick = (
// event: React.MouseEvent<HTMLDivElement, MouseEvent>,
// index: Number
// ) => {
// setSelectedIndex(index);
// };

const [openModal, setOpenModal] = React.useState(true);
const handleOpenModal = () => setOpenModal(true);
Expand Down Expand Up @@ -129,7 +131,7 @@ const LearnerProfile: React.FC = () => {
setSubject(event.target.value);
};

const handleMenuItemClick = (index, value) => {
const handleMenuItemClick = (index: any, value: any) => {
setSelectedIndex(index);
setSelectedValue(value);
console.log('Selected Value:', value); // You can use this value as needed
Expand All @@ -155,6 +157,7 @@ const LearnerProfile: React.FC = () => {
const data = response?.data;
if (data) {
const userData = data?.userData;

setUserData(userData);
console.log('userData', userData);
const customDataFields = userData?.customFields;
Expand Down Expand Up @@ -192,6 +195,7 @@ const LearnerProfile: React.FC = () => {
const result = response?.result;
if (result?.length > 0) {
const data = result;
setSubmitedOn(data?.createdOn);
setAssesmentData(data);
console.log('Data', data);
} else {
Expand All @@ -201,20 +205,20 @@ const LearnerProfile: React.FC = () => {
}
};

function getQuestionValues(data) {
function getQuestionValues(data: any) {
const questionValues = {
totalMaxScore: 0,
totalScore: 0,
length: data.length,
questions: [],
};

data.forEach((item) => {
item.assessmentSummary?.forEach((summary) => {
data.forEach((item: any) => {
item.assessmentSummary?.forEach((summary: any) => {
const parsedData = JSON.parse(summary.data);
let questionNumber = 1;
parsedData.forEach((section) => {
section.data.forEach((question, index) => {
parsedData.forEach((section: any) => {
section.data.forEach((question: any, index: any) => {
const questionValue = {
question: `Q${questionNumber}`,
mark_obtained: question.score,
Expand Down Expand Up @@ -558,7 +562,7 @@ const LearnerProfile: React.FC = () => {
{/* {assesmentData && assesmentData?.map((item, i) => {})}{' '} */}
<Box>
<Typography variant="h5">
Submitted On : 2nd Feb , 2024
Submitted On : {submittedOn}
</Typography>
</Box>
<Box display={'flex'} justifyContent={'space-between'} mt={1}>
Expand Down

0 comments on commit ad19ddd

Please sign in to comment.