Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/k UI 1600 remove fields #413

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion i18n/messages.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ module.exports = {
teacherAssistantsTitle: 'Teacher Assistants',
examinerTitle: 'Examiner',
otherContactsTitle: 'Other Contacts',
infoContactName: 'Course Contact',
},
extraInfo: {
season: {
Expand Down
1 change: 0 additions & 1 deletion i18n/messages.se.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ module.exports = {
teacherAssistantsTitle: 'Lärarassistenter',
examinerTitle: 'Examinator',
otherContactsTitle: 'Övriga kontakter',
infoContactName: 'Kontaktperson',
},
extraInfo: {
season: {
Expand Down
19 changes: 1 addition & 18 deletions public/js/app/components/AboutCourseContacts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@ import React from 'react'
import { EMPTY } from '../util/constants'
import HtmlWrapper from './HtmlWrapper'

// Mandatory information
const InfoContact = ({ languageIndex, infoContactName, labels }) =>
infoContactName ? (
<>
<h3 className="t4">{labels.infoContactName}</h3>
<HtmlWrapper id="links-info-contact-name" html={infoContactName} />
</>
) : (
<>
<h3 className="t4">{labels.infoContactName}</h3>
<p>
<i>{EMPTY[languageIndex]}</i>
</p>
</>
)

// Mandatory information
const ExaminerContacts = ({ languageIndex, examiners, labels }) =>
examiners ? (
Expand All @@ -35,10 +19,9 @@ const ExaminerContacts = ({ languageIndex, examiners, labels }) =>
</>
)

const CourseContacts = ({ languageIndex, infoContactName = '', examiners = '', labels = {} }) => (
const CourseContacts = ({ languageIndex, examiners = '', labels = {} }) => (
<>
<div className="info-box text-break">
<InfoContact languageIndex={languageIndex} infoContactName={infoContactName} labels={labels} />
<ExaminerContacts languageIndex={languageIndex} examiners={examiners} labels={labels} />
</div>
</>
Expand Down
1 change: 0 additions & 1 deletion public/js/app/pages/AboutCourseMemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ function AboutCourseMemo({ mockKursPmDataApi = false, mockMixKoppsApi = false })
<h2>{courseContactsLabels.courseContactsTitle}</h2>
<AboutCourseContacts
languageIndex={userLanguageIndex}
infoContactName={webContext.infoContactName}
examiners={webContext.examiners}
labels={courseContactsLabels}
/>
Expand Down
4 changes: 2 additions & 2 deletions public/js/app/pages/__tests__/AboutCourseMemoEN.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('User language: English. Component <AboutCourseMemo> show all memos: pd
const mainContent = screen.getByRole('main')

const allH3Headers = within(mainContent).getAllByRole('heading', { level: 3 })
expect(allH3Headers.length).toBe(5)
expect(allH3Headers.length).toBe(4)
const expectedh3ds = [
'Course offerings starting Autumn 2020',
'Course offerings starting Autumn 2019',
Expand All @@ -109,7 +109,7 @@ describe('User language: English. Component <AboutCourseMemo> show all memos: pd

test('renders text about empty fields (Course Contact, Examiner) ', () => {
const noInfo = getAllByText('No information inserted')
expect(noInfo.length).toBe(2)
expect(noInfo.length).toBe(1)
})

test('renders menu link of web-based memo as expected', () => {
Expand Down
7 changes: 1 addition & 6 deletions public/js/app/pages/__tests__/AboutCourseMemoSV.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('User language: Swedish. Component <AboutCourseMemo> show all memos: pd
test('renders h3 ', () => {
const mainContent = screen.getByRole('main')
const allH3Headers = within(mainContent).getAllByRole('heading', { level: 3 })
expect(allH3Headers.length).toBe(5)
expect(allH3Headers.length).toBe(4)
const expectedh3ds = [
'Kursomgångar som startar HT 2020',
'Kursomgångar som startar HT 2019',
Expand All @@ -108,11 +108,6 @@ describe('User language: Swedish. Component <AboutCourseMemo> show all memos: pd
expectedh4ds.map((h4, index) => expect(allH4Headers[index]).toHaveTextContent(h4))
})

test('renders text about empty fields (Kontaktperson) ', () => {
const noInfo = getAllByText('Ingen information tillagd')
expect(noInfo.length).toBe(1)
})

test('renders menu link of web-based memo as expected', done => {
const menuItems = getAllByText('Course memo Autumn 2019-1')
expect(menuItems.length).toBe(2)
Expand Down
26 changes: 10 additions & 16 deletions server/controllers/memoCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,17 @@ async function getContent(req, res, next) {

let fromTerm = semester ?? extractTerm(courseCode, finalMemoEndPoint)

const {
courseMainSubjects,
recruitmentText,
title,
credits,
creditUnitAbbr,
infoContactName,
examiners,
roundInfos,
} = await getDetailedInformation(courseCode, languagesContext.memoLanguage, fromTerm)
const { courseMainSubjects, title, credits, creditUnitAbbr, examiners, roundInfos } = await getDetailedInformation(
courseCode,
languagesContext.memoLanguage,
fromTerm
)

const courseContext = {
courseMainSubjects,
title,
credits,
creditUnitAbbr,
infoContactName,
examiners,
}

Expand Down Expand Up @@ -330,15 +324,16 @@ async function getOldContent(req, res, next) {
memoDatas: [],
}

const { courseMainSubjects, recruitmentText, title, credits, creditUnitAbbr, infoContactName, examiners } =
await getDetailedInformation(courseCode, languagesContext.memoLanguage)
const { courseMainSubjects, title, credits, creditUnitAbbr, examiners } = await getDetailedInformation(
courseCode,
languagesContext.memoLanguage
)

const courseContext = {
courseMainSubjects,
title,
credits,
creditUnitAbbr,
infoContactName,
examiners,
}

Expand Down Expand Up @@ -416,15 +411,14 @@ async function getAboutContent(req, res, next) {

const fromTerm = getLastYearsTerm()

const { title, credits, creditUnitAbbr, infoContactName, examiners, roundInfos } = await getDetailedInformation(
const { title, credits, creditUnitAbbr, examiners, roundInfos } = await getDetailedInformation(
courseCode,
responseLanguage,
fromTerm
)
webContext.title = title
webContext.credits = credits
webContext.creditUnitAbbr = creditUnitAbbr
webContext.infoContactName = infoContactName
webContext.examiners = examiners

webContext.memoDatas = enrichMemoDatasWithOutdatedFlag(rawMemos, roundInfos)
Expand Down
1 change: 0 additions & 1 deletion server/koppsApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ async function getDetailedInformation(courseCode, language, fromTerm) {
title: course && course.title ? course.title : '',
credits: isCreditNotStandard ? course.credits + '.0' : course.credits || '',
creditUnitAbbr: course && course.creditUnitAbbr ? course.creditUnitAbbr : '',
infoContactName: course && course.infoContactName ? course.infoContactName : '',
examiners: createPersonHtml(examiners),
roundInfos: roundInfos || [],
}
Expand Down
1 change: 0 additions & 1 deletion server/ssr-context/createServerSideContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function createServerSideContext() {
title: '',
credits: '',
creditUnitAbbr: '',
infoContactName: '',
semester: '',
examiners: '',
userLanguageIndex: 1,
Expand Down
1 change: 0 additions & 1 deletion test/mock-api/responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ module.exports = {
extraHeaders4: '',
extraHeaders5: '',
equipment: '',
infoContactName: '',
literature: '',
possibilityToCompletion: '',
possibilityToAddition: '',
Expand Down
Loading