Skip to content

Commit

Permalink
Issues/KUI 1599 remove fields (#389)
Browse files Browse the repository at this point in the history
* feat(KUI-1599): remove infoContactName from whole project

* feat(KUI-1599): remove addOn from whole project

* feat(KUI-1599): remove applicationInfo from whole project

* feat(KUI-1599): remove possibilityToCompletion from whole project

* feat(KUI-1599): remove possibilityToAddition from whole project

* feat(KUI-1599): remove requiredEquipment from whole project
  • Loading branch information
amirhossein-haerian authored Nov 25, 2024
1 parent 42bd5b0 commit 1fc43df
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 135 deletions.
6 changes: 0 additions & 6 deletions i18n/messages.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,10 @@ module.exports = {
course_valid_from: 'Valid from',
course_main_subject: 'Main field of study',
course_language: 'Language of instruction',
course_required_equipment: 'Equipment',
course_level_code: 'Education cycle',
course_decision_to_discontinue: 'Avvecklingsbeslut',
course_transitional_reg: 'Transitional regulations',
course_ethical: 'Ethical approach',
course_possibility_to_completions: 'Opportunity to complete the requirements via supplementary examination',
course_possibility_to_addition: 'Opportunity to raise an approved grade via renewed examination',
course_short_semester: {
1: 'Spring ',
2: 'Autumn ',
Expand All @@ -159,12 +156,10 @@ module.exports = {
RESEARCH: 'Third cycle',
},
course_department: 'Offered by',
course_contact_name: 'Contact ',
course_prerequisites: 'Recommended prerequisites',
course_prerequisites_description:
'Describes the knowledge and skills (in addition to the eligibility requirements) that you need to be able to take the course.',
course_prerequisites_menu_aria_label: 'Information about recommended prerequisites',
course_suggested_addon_studies: 'Add-on studies',
course_supplemental_information_url: 'Supplementary information link',
course_supplemental_information_url_text: 'Supplementary information link text',
course_supplemental_information: 'Supplementary information ',
Expand All @@ -173,7 +168,6 @@ module.exports = {
course_room_canvas: 'Course room in Canvas',
course_room_canvas_info:
'Registered students find further information about the implementation of the course in the course room in Canvas. A link to the course room can be found under the tab Studies in the Personal menu at the start of the course.',
course_application_info: 'Information for research students about course offerings',
},
courseRoundInformation: {
round_header: 'Information for',
Expand Down
6 changes: 0 additions & 6 deletions i18n/messages.se.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,10 @@ module.exports = {
course_valid_from: 'Giltig från',
course_main_subject: 'Huvudområde',
course_language: 'Undervisningsspråk',
course_required_equipment: 'Utrustning',
course_level_code: 'Utbildningsnivå',
course_decision_to_discontinue: 'Avvecklingsbeslut',
course_transitional_reg: 'Övergångsbestämmelser',
course_ethical: 'Etiskt förhållningssätt',
course_possibility_to_completions: 'Möjlighet till komplettering',
course_possibility_to_addition: 'Möjlighet till plussning',
course_short_semester: {
1: 'VT ',
2: 'HT ',
Expand All @@ -161,12 +158,10 @@ module.exports = {
RESEARCH: 'Forskarnivå',
},
course_department: 'Ges av',
course_contact_name: 'Kontaktperson',
course_prerequisites: 'Rekommenderade förkunskaper',
course_prerequisites_description:
'Beskriver vilka kunskaper och färdigheter (utöver behörighetskraven) som du behöver för att kunna ta till dig kursen.',
course_prerequisites_menu_aria_label: 'Information om rekommenderade förkunskaper',
course_suggested_addon_studies: 'Påbyggnad',
course_supplemental_information_url: 'Övrig information - länk',
course_supplemental_information_url_text: 'Övrig information - länk text',
course_supplemental_information: 'Övrig information',
Expand All @@ -175,7 +170,6 @@ module.exports = {
course_room_canvas: 'Kursrum i Canvas',
course_room_canvas_info:
'Registrerade studenter hittar information för genomförande av kursen i kursrummet i Canvas. En länk till kursrummet finns under fliken Studier i Personliga menyn vid kursstart.',
course_application_info: 'Information för forskarstuderande om när kursen ges',
},
courseRoundInformation: {
round_header: 'Information för',
Expand Down
19 changes: 0 additions & 19 deletions public/js/app/components/CourseSectionList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ function CourseSectionList({ courseInfo = {}, partToShow, syllabus = {}, syllabu
literatureText = `${syllabus.course_literature_comment}`
}

const courseRequiredEquipment = !isMissingInfoLabel(courseInfo.course_required_equipment)
? courseInfo.course_required_equipment
: syllabus.course_required_equipment

const eligibility = getEligibility()

const during = [
Expand All @@ -70,7 +66,6 @@ function CourseSectionList({ courseInfo = {}, partToShow, syllabus = {}, syllabu
ariaLabel: translation.courseInformation.course_prerequisites_menu_aria_label,
},
},
{ header: translation.courseInformation.course_required_equipment, text: courseRequiredEquipment },
{ header: translation.courseInformation.course_literature, text: literatureText },
]

Expand Down Expand Up @@ -110,14 +105,6 @@ function CourseSectionList({ courseInfo = {}, partToShow, syllabus = {}, syllabu
syllabusMarker: true,
})
}
examination.push({
header: translation.courseInformation.course_possibility_to_completions,
text: courseInfo.course_possibility_to_completions,
})
examination.push({
header: translation.courseInformation.course_possibility_to_addition,
text: courseInfo.course_possibility_to_addition,
})
examination.push({ header: translation.courseInformation.course_examiners, text: courseInfo.course_examiners })
examination.push({
header: translation.courseInformation.course_ethical,
Expand Down Expand Up @@ -147,13 +134,7 @@ function CourseSectionList({ courseInfo = {}, partToShow, syllabus = {}, syllabu
text: translation.courseInformation.course_level_code_label[courseInfo.course_level_code],
syllabusMarker: true,
},
{
header: translation.courseInformation.course_suggested_addon_studies,
text: courseInfo.course_suggested_addon_studies,
},
]
if (!isMissingInfoLabel(courseInfo.course_contact_name))
prepare.push({ header: translation.courseInformation.course_contact_name, text: courseInfo.course_contact_name })
if (syllabus.course_transitional_reg !== '')
prepare.push({
header: translation.courseInformation.course_transitional_reg,
Expand Down
6 changes: 0 additions & 6 deletions public/js/app/components/MainCourseInformation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ const MainCourseInformation = ({ courseCode, courseData, semesterRoundState }) =
</Alert>
)}

{courseInfo.course_application_info.length > 0 && (
<Alert type="info" header={translation.courseInformation.course_application_info}>
<span dangerouslySetInnerHTML={{ __html: courseInfo.course_application_info }} />
</Alert>
)}

<CourseSectionList
courseInfo={courseInfo}
// if there is no syllabus, we still want to display empty syllabus data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { usePlannedModules } from '../../hooks/usePlannedModules'
import { RoundInformationInfoGrid } from './RoundInformationInfoGrid'
import { RoundInformationContacts } from './RoundInformationContacts'

function RoundInformation({ courseCode, courseData, courseRound, semesterRoundState }) {
function RoundInformation({ courseCode, courseRound, semesterRoundState }) {
const { translation } = useLanguage()

const { createRoundHeader } = useRoundUtils()
Expand Down Expand Up @@ -75,7 +75,7 @@ function RoundInformation({ courseCode, courseData, courseRound, semesterRoundSt
)}

<h3>{translation.courseLabels.header_contact}</h3>
<RoundInformationContacts courseData={courseData} courseRoundEmployees={courseRoundEmployees ?? {}} />
<RoundInformationContacts courseRoundEmployees={courseRoundEmployees ?? {}} />
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { useLanguage } from '../../hooks/useLanguage'
import { useMissingInfo } from '../../hooks/useMissingInfo'

function RoundInformationContacts({ courseData, courseRoundEmployees }) {
function RoundInformationContacts({ courseRoundEmployees }) {
const { translation } = useLanguage()
const { missingInfoLabel } = useMissingInfo()

Expand All @@ -26,15 +26,6 @@ function RoundInformationContacts({ courseData, courseRoundEmployees }) {
<dt>{translation.courseRoundInformation.round_teacher}</dt>
<dd dangerouslySetInnerHTML={{ __html: courseRoundEmployees.teachers || missingInfoLabel }} />
</div>

{courseData.course_contact_name && courseData.course_contact_name !== missingInfoLabel && (
<div>
<dt>{translation.courseInformation.course_contact_name}</dt>
<dd>
<p>{courseData.course_contact_name}</p>
</dd>
</div>
)}
</div>
)
}
Expand Down
6 changes: 0 additions & 6 deletions public/js/app/components/__tests__/RoundInformation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('Component <RoundInformation>', () => {
const propsWithStudyPace = {
memoStorageUri: '',
semesterRoundState: defaultSemesterRoundState,
courseData: {},
courseRound: {
round_course_term: ['2018', '1'],
round_study_pace: '25',
Expand All @@ -67,7 +66,6 @@ describe('Component <RoundInformation>', () => {
const propsWithEmployees = {
memoStorageUri: '',
semesterRoundState: defaultSemesterRoundState,
courseData: {},
courseCode: 'SF1624',
courseRound: mockCourseRound,
}
Expand Down Expand Up @@ -97,7 +95,6 @@ describe('Component <RoundInformation>', () => {
const propsWithEmptyEmployees = {
memoStorageUri: '',
semesterRoundState: defaultSemesterRoundState,
courseData: {},
courseCode: 'SF1624',
courseRound: mockCourseRound,
}
Expand All @@ -115,7 +112,6 @@ describe('Component <RoundInformation>', () => {
const propsWithoutEmployees = {
memoStorageUri: '',
semesterRoundState: defaultSemesterRoundState,
courseData: {},
courseCode: 'SF1624',
courseRound: mockCourseRound,
}
Expand Down Expand Up @@ -171,7 +167,6 @@ describe('Component <RoundInformation>', () => {
const propsWithoutSeatsNum = {
memoStorageUri: '',
semesterRoundState: defaultSemesterRoundState,
courseData: {},
courseRound: {
round_course_term: ['2018', '1'],
round_selection_criteria: '<p>English. Spicy jalapeno bacon ipsum</p>',
Expand Down Expand Up @@ -200,7 +195,6 @@ describe('Component <RoundInformation>', () => {
const propsWithEmptyCriteria = {
memoStorageUri: '',
semesterRoundState: defaultSemesterRoundState,
courseData: {},
courseRound: {
round_course_term: ['2018', '1'],
round_selection_criteria: '<p></p>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const withinNextSibling = element => within(nextSibling(element))
describe('Component <RoundInformationContacts>', () => {
describe('examiners, responsibles and teachers', () => {
test('shoud show headers with "missing info" text when data is missing', () => {
render(<RoundInformationContacts courseData={{}} courseRoundEmployees={{}} />)
render(<RoundInformationContacts courseRoundEmployees={{}} />)
const examinerLabel = screen.getByText('Examiner')
expect(nextSibling(examinerLabel)).toHaveTextContent('No information inserted')

Expand All @@ -36,7 +36,6 @@ describe('Component <RoundInformationContacts>', () => {
test('shoud show headers with data inserted as html', () => {
render(
<RoundInformationContacts
courseData={{ courseInfo: { course_contact_name: undefined } }}
courseRoundEmployees={{
examiners: '<p class="person"><a href="/profile/testexaminers/">Test examiners</a></p>',
responsibles: '<p class="person"><a href="/profile/testresponsibles/">Test responsibles</a></p>',
Expand All @@ -60,24 +59,4 @@ describe('Component <RoundInformationContacts>', () => {
expect(teacherLink).toHaveAttribute('href', '/profile/testteachers/')
})
})

describe('cource contact', () => {
test('should show header and content for course contact name', () => {
render(
<RoundInformationContacts courseData={{ course_contact_name: 'Contact name' }} courseRoundEmployees={{}} />
)
const contactLabel = screen.getByText('Contact')
expect(contactLabel).toBeInTheDocument()
})
test.each([undefined, '<i>No information inserted</i>'])(
"shoud NOT show header if contact name is '%s'",
contactNameArg => {
render(
<RoundInformationContacts courseData={{ course_contact_name: contactNameArg }} courseRoundEmployees={{}} />
)
const contactLabel = screen.queryByText('Contact')
expect(contactLabel).not.toBeInTheDocument()
}
)
})
})
2 changes: 0 additions & 2 deletions public/js/app/hooks/__tests__/useSemesterRoundState.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ const syllabusList = [
semesterNumber: 2,
},
course_valid_to: [],
course_required_equipment: '<i>No information inserted</i>',
course_examination:
"<ul class='ul-no-padding' ><li>TEN1 - \n Examination,\n 7.5 credits, \n grading scale: A, B, C, D, E, FX, F \n </li></ul>",
course_examination_comments:
Expand Down Expand Up @@ -187,7 +186,6 @@ const syllabusList = [
year: 2019,
semesterNumber: 1,
},
course_required_equipment: '<i>No information inserted</i>',
course_examination:
"<ul class='ul-no-padding' ><li>TEN1 - \n Examination,\n 7.5 credits, \n grading scale: A, B, C, D, E, FX, F \n </li></ul>",
course_examination_comments:
Expand Down
19 changes: 2 additions & 17 deletions public/js/app/pages/CoursePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function CoursePage() {
browserConfig,
courseCode,
courseData = {
courseInfo: { course_application_info: '' },
courseInfo: {},
syllabusList: [],
},
isCancelledOrDeactivated,
Expand Down Expand Up @@ -59,16 +59,6 @@ function CoursePage() {
courseImage = `${browserConfig.imageStorageUri}${courseImage}`

const decisionToDiscontinue = hasSyllabus ? activeSyllabus.course_decision_to_discontinue : ''
const course_valid_from = hasSyllabus ? activeSyllabus.course_valid_from : ''

const courseInformationToRounds = {
course_code: courseCode,
course_examiners: courseInfo.course_examiners,
course_contact_name: courseInfo.course_contact_name,
course_main_subject: courseInfo.course_main_subject,
course_level_code: courseInfo.course_level_code,
course_valid_from,
}

useEffect(() => {
let isMounted = true
Expand Down Expand Up @@ -129,12 +119,7 @@ function CoursePage() {
<RoundSelector activeSemesters={activeSemesters} semesterRoundState={semesterRoundState} />

{showRoundData && (
<RoundInformation
courseCode={courseCode}
courseData={courseInformationToRounds}
courseRound={activeRound}
semesterRoundState={semesterRoundState}
/>
<RoundInformation courseCode={courseCode} courseRound={activeRound} semesterRoundState={semesterRoundState} />
)}

<MainCourseInformation
Expand Down
4 changes: 1 addition & 3 deletions public/js/app/pages/__tests__/CoursePage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ describe('Component <CoursePage>', () => {
],
courseCode: 'MF1016',
courseData: {
courseInfo: {
course_application_info: '',
},
courseInfo: {},
courseTitleData: {
course_code: 'MF1016',
course_credits: 9,
Expand Down
14 changes: 0 additions & 14 deletions server/apiCalls/getFilteredData.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,10 @@ const {
const koppsCourseData = require('./koppsCourseData')
const courseApi = require('./kursinfoApi')

function parceContactName(infoContactName, language) {
const courseContactName = parseOrSetEmpty(infoContactName, language)
if (courseContactName === INFORM_IF_IMPORTANT_INFO_IS_MISSING[language]) return courseContactName
const emailBracketsRexEx = /<|>/gi
const contact = courseContactName.replace(emailBracketsRexEx, '')
return contact
}

function _parseCourseDefaultInformation(courseDetails, language) {
const { course, formattedGradeScales, mainSubjects } = courseDetails
return {
course_application_info: parseOrSetEmpty(course.applicationInfo, language, true), // applicationInfo is info for research students (Label in Kopps: "Information for research students about course offerings")
course_code: parseOrSetEmpty(course.courseCode),
course_contact_name: parceContactName(course.infoContactName, language),
course_department: parseOrSetEmpty(course.department.name, language),
course_department_code: parseOrSetEmpty(course.department.code, language),
course_department_link: buildCourseDepartmentLink(course.department, language),
Expand All @@ -42,11 +32,7 @@ function _parseCourseDefaultInformation(courseDetails, language) {
mainSubjects && mainSubjects.length > 0
? mainSubjects.join(', ')
: INFORM_IF_IMPORTANT_INFO_IS_MISSING_ABOUT_MIN_FIELD_OF_STUDY[language],
course_possibility_to_addition: parseOrSetEmpty(course.possibilityToAddition, language),
course_possibility_to_completions: parseOrSetEmpty(course.possibilityToCompletion, language),
course_recruitment_text: parseOrSetEmpty(course.recruitmentText, language, true),
course_required_equipment: parseOrSetEmpty(course.requiredEquipment, language),
course_suggested_addon_studies: parseOrSetEmpty(course.addOn, language),
course_state: parseOrSetEmpty(course.state, language, true),
}
}
Expand Down
Loading

0 comments on commit 1fc43df

Please sign in to comment.