Skip to content

Commit

Permalink
Merge pull request #3278 from Opetushallitus/tor-2262-ib-kali-lisayksia
Browse files Browse the repository at this point in the history
TOR-2262: Lisäyksiä IB-käliin
  • Loading branch information
ilkkahanninen authored Jan 17, 2025
2 parents 031e9d7 + acdcbe4 commit 13dfa2c
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 191 deletions.
49 changes: 0 additions & 49 deletions web/app/ib/IB.jsx

This file was deleted.

43 changes: 42 additions & 1 deletion web/app/ib/IBEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ import { UusiPreIB2015OsasuoritusDialog } from './dialogs/UusiPreIB2015Osasuorit
import { UusiPreIB2019OppiaineDialog } from './dialogs/UusiPreIB2019OppiaineDialog'
import { UusiPreIB2019OsasuoritusDialog } from './dialogs/UusiPreIB2019OsasuoritusDialog'
import { containsPaikallinenSuoritus } from '../util/suoritus'
import { IBTutkinnonSuoritus } from '../types/fi/oph/koski/schema/IBTutkinnonSuoritus'
import {
IBTutkinnonSuoritus,
isIBTutkinnonSuoritus
} from '../types/fi/oph/koski/schema/IBTutkinnonSuoritus'
import { append } from '../util/fp/arrays'
import { PreIBSuoritus2019 } from '../types/fi/oph/koski/schema/PreIBSuoritus2019'
import { LocalizedString } from '../types/fi/oph/koski/schema/LocalizedString'
import { Koodistokoodiviite } from '../types/fi/oph/koski/schema/Koodistokoodiviite'
import { OrganisaatioWithOid } from '../types/fi/oph/koski/schema/OrganisaatioWithOid'

export type IBEditorProps = AdaptedOpiskeluoikeusEditorProps<IBOpiskeluoikeus>

Expand Down Expand Up @@ -97,13 +105,46 @@ const IBPäätasonSuoritusEditor: React.FC<
[päätasonSuoritus]
)

const fillNimet = useKoodistoFiller()

const addSuoritusProps = useMemo(() => {
const createSuoritus = async (
suoritusCtor: (props: {
suorituskieli: Koodistokoodiviite<'kieli'>
toimipiste: OrganisaatioWithOid
}) => IBPäätasonSuoritus
) => {
const pohjasuoritus = form.state.suoritukset[0]
const uusiSuoritus = suoritusCtor({
suorituskieli: pohjasuoritus.suorituskieli,
toimipiste: pohjasuoritus.toimipiste
})
const filledSuoritus = await fillNimet(uusiSuoritus)
form.modify('suoritukset')(append(filledSuoritus))
}

const suoritukset = form.state.suoritukset
if (suoritukset.length < 2) {
return isIBTutkinnonSuoritus(suoritukset[0])
? {
suorituksenLisäys: t('lisää pre-IB-suoritus'),
onCreateSuoritus: () => createSuoritus(PreIBSuoritus2019)
}
: {
suorituksenLisäys: t('lisää IB-tutkinnon suoritus'),
onCreateSuoritus: () => createSuoritus(IBTutkinnonSuoritus)
}
}
}, [form])

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 Tests / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

Check warning on line 138 in web/app/ib/IBEditor.tsx

View workflow job for this annotation

GitHub Actions / 👀 / Lint Koski

React Hook useMemo has a missing dependency: 'fillNimet'. Either include it or remove the dependency array

return (
<EditorContainer
form={form}
oppijaOid={oppijaOid}
invalidatable={invalidatable}
onChangeSuoritus={setPäätasonSuoritus}
createOpiskeluoikeusjakso={LukionOpiskeluoikeusjakso}
{...addSuoritusProps}
>
<TestIdRoot id={päätasonSuoritus.testId}>
<IBPäätasonSuoritusTiedot
Expand Down
15 changes: 0 additions & 15 deletions web/app/ib/IBKurssinArviointiEditor.jsx

This file was deleted.

81 changes: 0 additions & 81 deletions web/app/ib/IBYhteinenSuoritus.jsx

This file was deleted.

3 changes: 0 additions & 3 deletions web/app/kurssi/KurssiPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import DIATutkintovaiheenLukukaudenArviointiEditor, {
hasLasketaanKokonaispistemäärään
} from '../dia/DIATutkintovaiheenLukukaudenArviointiEditor'
import { PropertiesEditor } from '../editor/PropertiesEditor'
import IBKurssinArviointiEditor from '../ib/IBKurssinArviointiEditor'
import AikuistenPerusopetuksenKurssinArviointiEditor from '../perusopetus/AikuistenPerusopetuksenKurssinArviointiEditor'
import { hasArviointi } from '../suoritus/Suoritus'
import { isAikuistenPerusopetuksenKurssi, isIBKurssi } from './kurssi'
Expand All @@ -19,8 +18,6 @@ export const isDIAOsasuorituksenArviointi = (osasuoritus) => (property) =>
hasLasketaanKokonaispistemäärään(osasuoritus)

const resolvePropertyEditor = (model, property) => {
if (isIBKurssi(model) && property.key === 'arviointi')
return IBKurssinArviointiEditor
if (
isDIAOppiaineenTutkintovaiheenOsasuoritus(model) &&
property.key === 'arviointi'
Expand Down
9 changes: 1 addition & 8 deletions web/app/kurssi/OmatTiedotKurssit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
isPreIBKurssi
} from '../suoritus/Koulutusmoduuli'
import { PropertiesEditor } from '../editor/PropertiesEditor'
import IBKurssinArviointiEditor from '../ib/IBKurssinArviointiEditor'
import { ArvosanaEditor } from '../suoritus/ArvosanaEditor'
import { FootnoteHint } from '../components/footnote'
import Text from '../i18n/Text'
Expand Down Expand Up @@ -131,13 +130,7 @@ class MobileKurssi extends React.Component {
!['tunniste', 'koodiarvo', 'nimi'].includes(p.key)
}
className="kansalainen"
getValueEditor={(prop, getDefault) =>
isIBKurssi(kurssi) && prop.key === 'arviointi' ? (
<IBKurssinArviointiEditor model={kurssi} />
) : (
getDefault()
)
}
getValueEditor={(prop, getDefault) => getDefault()}
/>
</td>
</tr>
Expand Down
1 change: 0 additions & 1 deletion web/app/suoritus/OmatTiedotRyhmiteltyOppiaineet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { modelData, modelItems } from '../editor/EditorModel'
import { t } from '../i18n/i18n'
import { isMobileAtom } from '../util/isMobileAtom'
import { OmatTiedotLukionOppiaineetTableHead } from '../lukio/fragments/LukionOppiaineetTableHead'
import { arvosanaFootnote } from '../ib/IB'
import { FootnoteDescriptions } from '../components/footnote'
import { OmatTiedotLukionOppiaine } from '../lukio/OmatTiedotLukionOppiaineet'
import { resolveArvosanaModel } from './ArvosanaEditor'
Expand Down
23 changes: 2 additions & 21 deletions web/app/suoritus/RyhmiteltyOppiaineetEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { modelData, modelItems } from '../editor/EditorModel'
import { t } from '../i18n/i18n'
import { LukionOppiaineetTableHead } from '../lukio/fragments/LukionOppiaineetTableHead'
import { LukionOppiaineEditor } from '../lukio/LukionOppiaineEditor'
import { arvosanaFootnote, ibRyhmät } from '../ib/IB'
import { UusiRyhmiteltyOppiaineDropdown } from '../oppiaine/UusiRyhmiteltyOppiaineDropdown'
import { FootnoteDescriptions } from '../components/footnote'
import {
Expand All @@ -30,16 +29,6 @@ const diaCustomizations = {
}

const typeDependentCustomizations = {
ibtutkinto: {
groupAineet: ibRyhmät,
laajuusyksikkö: 'kurssia',
useOppiaineLaajuus: false,
showArviointi: true,
showRyhmättömät: false,
oppiaineOptionsFilter: R.identity,
getFootnote: (oppiaine) =>
modelData(oppiaine, 'arviointi.-1.predicted') && arvosanaFootnote
},
diavalmistavavaihe: diaCustomizations,
diatutkintovaihe: R.mergeDeepWith(R.concat, diaCustomizations, {
additionalEditableProperties: [
Expand Down Expand Up @@ -135,17 +124,13 @@ export default ({
edit
)

const isIbTutkinto = suorituksetModel.parent.value.classes.includes(
'ibtutkinnonsuoritus'
)

const commonOppiaineProps = {
additionalEditableProperties,
additionalEditableKoulutusmoduuliProperties,
useOppiaineLaajuus,
showArviointi,
showKeskiarvo: !isIbTutkinto,
showPredictedArviointi: isIbTutkinto,
showKeskiarvo: true,
showPredictedArviointi: false,
customOsasuoritusTitle,
customOsasuoritusAlternativesCompletionFn: customOsasuoritusAlternativesFn,
customKurssitSortFn
Expand All @@ -157,10 +142,6 @@ export default ({
<LukionOppiaineetTableHead
laajuusyksikkö={laajuusyksikkö}
showArviointi={showArviointi}
showPredictedArviointi={isIbTutkinto}
arvosanaHeader={
isIbTutkinto ? <Text name="Päättöarvosana" /> : undefined
}
/>
<tbody>
{aineryhmät.map((ryhmät) =>
Expand Down
12 changes: 0 additions & 12 deletions web/app/suoritus/suoritusEditorMapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import {
ebSuorituksenClass,
eshSuorituksenClass
} from '../esh/europeanschoolofhelsinkiSuoritus'
import {
CreativityActionService,
ExtendedEssay,
TheoryOfKnowledge
} from '../ib/IBYhteinenSuoritus'
import InternationalSchoolOppiaineetEditor from '../internationalschool/InternationalSchoolOppiaineetEditor'
import { MuuKuinSäänneltySuoritustaulukko } from '../jotpa/MuuKuinSäänneltySuoritustaulukko'
import {
Expand Down Expand Up @@ -284,13 +279,6 @@ export const resolvePropertyEditor = (
return null
}

// IB
case 'theoryOfKnowledge':
return <TheoryOfKnowledge model={property.model} />
case 'creativityActionService':
return <CreativityActionService model={property.model} />
case 'extendedEssay':
return <ExtendedEssay model={property.model} />
case 'täydentääTutkintoa':
return <TäydentääTutkintoaEditor model={property.model} />

Expand Down

0 comments on commit 13dfa2c

Please sign in to comment.