${rejectedByStr}
${oldText}
` as HTMLText } else if (isDeleted) { + testGroup.isAddition = false // If deletion has never been false, everything is deleted, so it will stay true. if (testGroup.isDeletion !== false) { testGroup.isDeletion = true @@ -161,8 +173,13 @@ export const formatAmendingRegBody = ( } } else if (isAddition) { testGroup.isDeletion = false + // If addition has never been false, everything is addition, so it will stay true. + if (testGroup.isAddition !== false) { + testGroup.isAddition = true + } if (isParagraph) { // Paragraph was added + testGroup.original?.push(`${newText}
` as HTMLText) pushHtml = paragraph > 1 ? (`Á eftir ${ @@ -171,6 +188,7 @@ export const formatAmendingRegBody = ( : (`
1. mgr. ${articleTitle} ${regNameDisplay} orðast svo:
${newText}
` as HTMLText) } else if (isArticleTitle) { // Title was added + testGroup.original?.push(`${newText}
` as HTMLText) pushHtml = `Fyrirsögn ${articleTitle} ${regNameDisplay} orðast svo:
${newText}
` as HTMLText } else if (isLetterList || isNumberList) { @@ -187,16 +205,20 @@ export const formatAmendingRegBody = ( ? `${newText}
` + testGroup.original?.push(newLiTextBody as HTMLText) pushHtml = `${ isLetterList ? 'Stafliðum' : 'Töluliðum' } eftir ${paragraph}. mgr. ${articleTitle} ${regNameDisplay} er bætt við:
${newLiTextBody}` as HTMLText } else { // We don't know what you added, but there was an addition, and here's the additionlog: + testGroup.original?.push(`${newText}
` as HTMLText) pushHtml = `Eftirfarandi texta ${regNameDisplay} var bætt við:
${newText}
` as HTMLText } } else { + // Change detected. Not additon, not deletion. testGroup.isDeletion = false + testGroup.isAddition = false if (isArticleTitle) { // Title was changed pushHtml = @@ -219,13 +241,30 @@ export const formatAmendingRegBody = ( } testGroup.arr.push(pushHtml) } else { + // Change detected. Not additon, not deletion. testGroup.isDeletion = false + testGroup.isAddition = false } }) if (testGroup.isDeletion === true) { const articleTitleNumber = testGroup.title additionArray.push([ - `${articleTitleNumber} fellur brott
` as HTMLText, + `${articleTitleNumber} ${regNameDisplay} fellur brott
` as HTMLText, + ]) + } else if (testGroup.isAddition === true) { + let prevArticleTitle = '' + const prevArticle = groupedArticles?.[i - 1] + if (prevArticle.length > 0) { + prevArticleTitle = prevArticle[0]?.innerText + } + const articleTitleNumber = testGroup.title + const originalTextArray = testGroup.original?.length + ? flatten(testGroup.original) + : [] + additionArray.push([ + `Á eftir ${prevArticleTitle} ${regNameDisplay} kemur ný grein, ${articleTitleNumber}, ásamt fyrirsögn, svohljóðandi: ${
+ originalTextArray ? testGroup.original?.join('') : ''
+ }` as HTMLText,
])
} else {
additionArray.push(testGroup.arr)
diff --git a/libs/service-portal/education/src/screens/DrivingLessonsBook/DrivingLessonsBook.tsx b/libs/service-portal/education/src/screens/DrivingLessonsBook/DrivingLessonsBook.tsx
index 0c26876718fd..0a6a258ba475 100644
--- a/libs/service-portal/education/src/screens/DrivingLessonsBook/DrivingLessonsBook.tsx
+++ b/libs/service-portal/education/src/screens/DrivingLessonsBook/DrivingLessonsBook.tsx
@@ -16,7 +16,6 @@ import {
m,
formatDate,
IntroHeader,
- EmptyState,
FootNote,
LinkResolver,
SAMGONGUSTOFA_SLUG,
@@ -29,6 +28,7 @@ import {
import PhysicalLessons from '../../components/DrivingLessonsTables/PhysicalLessons'
import DrivingLessonsSchools from '../../components/DrivingLessonsTables/DrivingLessonsSchools'
import Exams from '../../components/DrivingLessonsTables/Exams'
+import { Problem } from '@island.is/react-spa/shared'
export const GET_STUDENT_BOOK = gql`
query GetUserDrivingLessonsBook {
@@ -104,6 +104,21 @@ const DrivingLessonsBook = () => {