diff --git a/src/features/uos_lifestyle/graduate_credit/components/LoadingIndicator.tsx b/src/features/uos_lifestyle/graduate_credit/components/LoadingIndicator.tsx
index 3341e8c6..5ce008d5 100644
--- a/src/features/uos_lifestyle/graduate_credit/components/LoadingIndicator.tsx
+++ b/src/features/uos_lifestyle/graduate_credit/components/LoadingIndicator.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import {View, ActivityIndicator} from 'react-native';
+import {ActivityIndicator} from 'react-native';
import {colors} from '@uoslife/design-system';
import styled from '@emotion/native';
diff --git a/src/features/uos_lifestyle/graduate_credit/components/SubjectDetailButton.tsx b/src/features/uos_lifestyle/graduate_credit/components/SubjectDetailButton.tsx
index 349808a0..1d010aef 100644
--- a/src/features/uos_lifestyle/graduate_credit/components/SubjectDetailButton.tsx
+++ b/src/features/uos_lifestyle/graduate_credit/components/SubjectDetailButton.tsx
@@ -5,6 +5,7 @@ import {ApiResponse} from '../types';
import {SUBJECT_BUTTON_LABEL} from '../configs/constants';
import {GraduateCreditNavigationProp} from '../navigators/types/graduateCredit';
import {SubjectCreditListRes} from '../../../../api/services/core/graduateCredit/graduateCreditAPI.type';
+
type SubjectProps = {
label: keyof typeof SUBJECT_BUTTON_LABEL | string;
// 학과 | 과목 | 교양 세부
@@ -31,7 +32,7 @@ const SubjectDetailButton = ({
return (
{label}
diff --git a/src/features/uos_lifestyle/graduate_credit/components/screens/CreditDetailScreen.tsx b/src/features/uos_lifestyle/graduate_credit/components/screens/CreditDetailScreen.tsx
index 98838f6a..d2240d86 100644
--- a/src/features/uos_lifestyle/graduate_credit/components/screens/CreditDetailScreen.tsx
+++ b/src/features/uos_lifestyle/graduate_credit/components/screens/CreditDetailScreen.tsx
@@ -6,11 +6,15 @@ import styled from '@emotion/native';
import {Txt, colors, Icon} from '@uoslife/design-system';
import ProgressBar from '../ProgressBar';
import {GraduateCreditStackParamList} from '../../navigators/types/graduateCredit';
-import {ApiResponse, CreditDetail} from '../../types';
+import {
+ ApiResponse,
+ CreditDetail,
+ GeneralEducationDetailList,
+ GeneralEducationDetail,
+} from '../../types';
import LoadingIndicator from '../LoadingIndicator';
import Header from '../../../../../components/molecules/common/header/Header';
import {SubjectCreditListRes} from '../../../../../api/services/core/graduateCredit/graduateCreditAPI.type';
-import {GeneralEducationDetailList, GeneralEducationDetail} from '../../types';
import SubjectDetailButton from '../SubjectDetailButton';
type DetailInformationComponentProps = {
@@ -46,7 +50,7 @@ const MainMajorDetailComponent = ({
-
+
-
+
{generalRequirementDetailCredit.map(
- (item: GeneralEducationDetail, index: number) => {
+ (item: GeneralEducationDetail) => {
if (item.courseTotal < item.courseRequirement) {
return (
);
- } else {
- return null;
}
+ return null;
},
)}
@@ -331,7 +334,7 @@ const SubjectDetailComponent = ({
{generalElectiveDetailCredit.map(
- (item: GeneralEducationDetail, index: number) => {
+ (item: GeneralEducationDetail) => {
if (item.courseTotal < item.courseRequirement) {
return (
);
- } else {
- return null;
}
+ return null;
},
)}
diff --git a/src/features/uos_lifestyle/graduate_credit/components/screens/GraduateCreditScreen.tsx b/src/features/uos_lifestyle/graduate_credit/components/screens/GraduateCreditScreen.tsx
index c325e8db..f871b201 100644
--- a/src/features/uos_lifestyle/graduate_credit/components/screens/GraduateCreditScreen.tsx
+++ b/src/features/uos_lifestyle/graduate_credit/components/screens/GraduateCreditScreen.tsx
@@ -72,7 +72,7 @@ const GraduateCreditScreen = () => {
queryKey: ['getGraduateCredit'],
queryFn: async () => {
const data = await CoreAPI.getAllGraduateCredit();
- setGraduateCreditData(data);
+ setGraduateCreditData(data as GraduateCreditRes);
return data;
},
},
@@ -80,7 +80,7 @@ const GraduateCreditScreen = () => {
queryKey: ['getNecessaryCredit'],
queryFn: async () => {
const data = await CoreAPI.getNecessarySubjectCredit();
- setGeneralEducationInfo(data);
+ setGeneralEducationInfo(data as SubjectCreditListRes);
return data;
},
},
@@ -94,7 +94,6 @@ const GraduateCreditScreen = () => {
const isPendingForGetNecessaryCredit = generalDetailCreditData.isLoading;
const isErrorForGetNecessaryCredit = generalDetailCreditData.isError;
-
const {
isSuccess: isSuccessForCreateCredit,
isPending: isPendingForCreateCredit,
@@ -103,7 +102,7 @@ const GraduateCreditScreen = () => {
mutationFn: () => CoreAPI.createGraduateCredit(),
onSuccess: data => {
queryClient.invalidateQueries({queryKey: ['getNecessaryCredit']});
- setGraduateCreditData(data);
+ setGraduateCreditData(data as GraduateCreditRes);
},
});
diff --git a/src/features/uos_lifestyle/graduate_credit/configs/constants.ts b/src/features/uos_lifestyle/graduate_credit/configs/constants.ts
index 82d8616f..a8f89812 100644
--- a/src/features/uos_lifestyle/graduate_credit/configs/constants.ts
+++ b/src/features/uos_lifestyle/graduate_credit/configs/constants.ts
@@ -1,6 +1,5 @@
-// 전공필수/선택, 교양필수/선택 등 field 그룹화 위한 배열
import {ButtonConfig} from '../types';
-import {GraduateCreditRes} from '../../../../api/services/core/graduateCredit/graduateCreditAPI.type';
+
export const LABEL_MAPS: {[key: string]: string} = {
major: '전공',
generalEducation: '교양',
diff --git a/src/features/uos_lifestyle/graduate_credit/services/creditService.ts b/src/features/uos_lifestyle/graduate_credit/services/creditService.ts
index 6d4e0a44..b7948cd6 100644
--- a/src/features/uos_lifestyle/graduate_credit/services/creditService.ts
+++ b/src/features/uos_lifestyle/graduate_credit/services/creditService.ts
@@ -6,11 +6,25 @@ import {
} from '../types';
import {GROUP_FIELDS, LABEL_MAPS, BUTTONS_LABEL} from '../configs/constants';
+const isCompletedCreditStatus = (
+ label: string,
+ inCompletedSubject: {
+ label: string;
+ current: number | null;
+ total: number | null;
+ }[],
+): boolean => {
+ return inCompletedSubject.some(subject => subject.label === label);
+};
+
class BusinessLogic {
private apiResponse: ApiResponse;
+
// 교양 세부정보
private necessarySubjectCredit: GeneralEducationDetailList;
+
private groupedFields: GroupedFields[];
+
private labelsMap: LabelsMap;
constructor(
@@ -101,16 +115,6 @@ class BusinessLogic {
}
// label이 미이수 과목 포함되었는지 확인
- private isCompletedCreditStatus(
- label: string,
- inCompletedSubject: {
- label: string;
- current: number | null;
- total: number | null;
- }[],
- ): boolean {
- return inCompletedSubject.some(subject => subject.label === label);
- }
public tags() {
const inCompletedSubject = this.getInCompletedSubjects();
@@ -131,26 +135,23 @@ class BusinessLogic {
switch (baseLabel) {
case 'major':
status =
- !this.isCompletedCreditStatus('전공 필수', inCompletedSubject) &&
- !this.isCompletedCreditStatus('전공 선택', inCompletedSubject);
+ !isCompletedCreditStatus('전공 필수', inCompletedSubject) &&
+ !isCompletedCreditStatus('전공 선택', inCompletedSubject);
break;
case 'doubleMajor':
status =
- !this.isCompletedCreditStatus(
- '복수전공 필수',
- inCompletedSubject,
- ) &&
- !this.isCompletedCreditStatus('복수전공 선택', inCompletedSubject);
+ !isCompletedCreditStatus('복수전공 필수', inCompletedSubject) &&
+ !isCompletedCreditStatus('복수전공 선택', inCompletedSubject);
break;
case 'minor':
status =
- !this.isCompletedCreditStatus('부전공 필수', inCompletedSubject) &&
- !this.isCompletedCreditStatus('부전공 선택', inCompletedSubject);
+ !isCompletedCreditStatus('부전공 필수', inCompletedSubject) &&
+ !isCompletedCreditStatus('부전공 선택', inCompletedSubject);
break;
case 'generalEducation':
status =
- !this.isCompletedCreditStatus('교양 필수', inCompletedSubject) &&
- !this.isCompletedCreditStatus('교양 선택', inCompletedSubject);
+ !isCompletedCreditStatus('교양 필수', inCompletedSubject) &&
+ !isCompletedCreditStatus('교양 선택', inCompletedSubject);
break;
default:
status = true;