Commit e6e3a246 authored by Ådne Karstad's avatar Ådne Karstad

feat(M2T): display elective and mandatory courses in separate tables

parent d94f6fac
......@@ -18,7 +18,6 @@
[generateProgramSelection(university)/]
[for (program : Program | university.programs)]
[generateStudyPlans(program)/]
[/for]
......@@ -44,13 +43,17 @@
[/template]
[template public generateStudyPlans(program : Program)]
<div id="[nameToId(program.name)/]" class="spp-table">
<div class="main-section" id="[nameToId(program.name)/]">
<div class="spp-table">
<h2>[program.name/]</h2
<p>[program.name/] is taken over [program.numberOfSemesters/] semesters.</p>
[for (semester : Semester | program.semesters)]
<h3>Semester [semester.semester/]</h3>
<table style="width=80%">
<table>
<tr>
<th>Code</th>
<th>Name</th>
......@@ -58,16 +61,106 @@
<th>Level</th>
</tr>
[for (course : Course | semester.selectedCourses)]
[generateCourseRow(course)/]
[/for]
</table>
[/for]
</div>
[generateCourseTables(program)/]
</div>
[/template]
[template public generateSpecializationTables(specialization : Specialisation)]
<div class="specialization-container">
<h2>Courses for specialization: [specialization.name/]</h2>
<div class="spp-table">
<h3>Mandatory Courses for [specialization.name/]</h3>
<table>
<tr>
<td>[course.code/]</td>
<td>[course.name/]</td>
<td>[course.credits/]</td>
<td>[course.level/]</td>
<th>Code</th>
<th>Name</th>
<th>Credits</th>
<th>Level</th>
</tr>
[for (course : Course | specialization.mandatoryCourses)]
[generateCourseRow(course)/]
[/for]
</table>
</div>
<div class="spp-table">
<h3>Elective Courses for [specialization.name/]</h3>
<table>
<tr>
<th>Code</th>
<th>Name</th>
<th>Credits</th>
<th>Level</th>
</tr>
[for (course : Course | specialization.electiveCourses)]
[generateCourseRow(course)/]
[/for]
</table>
</div>
</div>
[/template]
[template public generateCourseTables(program : Program)]
<div class="spp-table">
<h2>Mandatory Courses</h2>
<table>
<tr>
<th>Code</th>
<th>Name</th>
<th>Credits</th>
<th>Level</th>
</tr>
[for (course : Course | program.mandatoryCourses.courses)]
[generateCourseRow(course)/]
[/for]
</table>
</div>
<div class="spp-table">
<h2>Elective Courses</h2>
<table>
<tr>
<th>Code</th>
<th>Name</th>
<th>Credits</th>
<th>Level</th>
</tr>
[for (course : Course | program.electiveCourses.courses)]
[generateCourseRow(course)/]
[/for]
</table>
</div>
[for (specialization : Specialisation | program.specialisation)]
[generateSpecializationTables(specialization)/]
[/for]
[/template]
[template public generateCourseRow(course : Course)]
<tr>
<td>[course.code/]</td>
<td>[course.name/]</td>
<td>[course.credits/]</td>
<td>[course.level/]</td>
</tr>
[/template]
......@@ -2,7 +2,7 @@ const studyPlanSelector = document.querySelector('#programs');
let selectedStudyPlan = studyPlanSelector.value;
const hideAllPrograms = () => {
let programs = document.querySelectorAll('.spp-table');
let programs = document.querySelectorAll('.main-section');
programs.forEach((program) => {
program.style.display = 'none';
......@@ -14,7 +14,7 @@ const hideProgram = (program) => {
};
const showProgram = (program) => {
program.style.display = 'block';
program.style.display = 'flex';
};
const getElementFromId = (id) => {
......
......@@ -22,11 +22,45 @@ th {
border-collapse: collapse;
}
table {
width: 100%;
}
th,
td {
padding: 16px;
}
.main-section {
display: flex;
justify-content: center;
width: 100%;
flex-wrap: wrap;
}
/* .main-section > .spp-table {
flex: 0 50%;
} */
.specialization-container {
display: flex;
flex-direction: column;
align-items: center;
margin: 0;
width: 30%;
padding: 48px;
}
.spp-table {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
margin: 0;
width: 30%;
padding: 48px;
}
.spp-table tr:nth-child(odd) {
background-color: #aaaaaa;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<spp:University
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spp="platform:/plugin/tdt4250.spp.model/model/spp.ecore"
xsi:schemaLocation="platform:/plugin/tdt4250.spp.model/model/spp.ecore spp.ecore"
name="NTNU">
<programs
name="Lektor i realfag"
duration="IntegratedMasters">
<semesters
selectedCourses="//@institutes.0/@courses.0"/>
<semesters
season="Spring"
selectedCourses="//@institutes.0/@courses.4 //@institutes.1/@courses.1"/>
<semesters
season="Spring"
year="2"
selectedCourses="//@institutes.0/@courses.3"/>
<semesters
year="4"
selectedCourses="//@institutes.0/@courses.1 //@institutes.0/@courses.2"/>
<semesters
year="2"
selectedCourses="//@institutes.1/@courses.2"/>
<mandatoryCourses
courses="//@institutes.0/@courses.0 //@institutes.0/@courses.3 //@institutes.0/@courses.4 //@institutes.1/@courses.0 //@institutes.1/@courses.1 //@institutes.1/@courses.2"/>
<electiveCourses
courses="//@institutes.0/@courses.1 //@institutes.0/@courses.2"/>
</programs>
<institutes
name="Institutt for datateknologi og informatikk">
<courses
code="TDT4110"
name="Informasjonsteknologi, grunnkurs"
credits="7.5"/>
<courses
code="TDT4250"
name="Avansert programvaredesign"
credits="7.5"
level="SecoundDegreeCourse"/>
<courses
code="TDT4175"
name="Informasjonssystemer"
credits="7.5"
level="ThirdYearCourse"/>
<courses
code="TDT4140"
name="Programvareutvikling"
credits="7.5"
level="IntermediateCourse"
season="Spring"/>
<courses
code="TDT4100"
name="Objektorientert programmering"
credits="7.5"
season="Spring"/>
</institutes>
<institutes
name="Institutt for matematiske fag">
<courses
code="MA1101"
name="Grunnkurs i analyse I"
credits="7.5"/>
<courses
code="MA1102"
name="Grunnkurs i analyse II"
credits="7.5"
season="Spring"/>
<courses
code="TMA4135"
name="Matematikk 4D"
credits="7.5"
level="ThirdYearCourse"/>
</institutes>
</spp:University>
<?xml version="1.0" encoding="UTF-8"?>
<spp:University
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spp="platform:/plugin/tdt4250.spp.model/model/spp.ecore"
xsi:schemaLocation="platform:/plugin/tdt4250.spp.model/model/spp.ecore spp.ecore"
name="NTNU">
<programs
name="Lektor i realfag"
duration="IntegratedMasters">
<semesters
selectedCourses="//@institutes.0/@courses.0"/>
<semesters
season="Spring"
selectedCourses="//@institutes.0/@courses.4 //@institutes.1/@courses.1"/>
<semesters
season="Spring"
year="2"
selectedCourses="//@institutes.0/@courses.3"/>
<semesters
year="4"
selectedCourses="//@institutes.0/@courses.1 //@institutes.0/@courses.2"/>
<semesters
year="2"
selectedCourses="//@institutes.1/@courses.2"/>
<mandatoryCourses
courses="//@institutes.0/@courses.0 //@institutes.0/@courses.3 //@institutes.0/@courses.4 //@institutes.1/@courses.0 //@institutes.1/@courses.1 //@institutes.1/@courses.2"/>
<electiveCourses
courses="//@institutes.0/@courses.1 //@institutes.0/@courses.2"/>
</programs>
<institutes
name="Institutt for datateknologi og informatikk">
<courses
code="TDT4110"
name="Informasjonsteknologi, grunnkurs"
credits="7.5"/>
<courses
code="TDT4250"
name="Avansert programvaredesign"
credits="7.5"
level="SecoundDegreeCourse"/>
<courses
code="TDT4175"
name="Informasjonssystemer"
credits="7.5"
level="ThirdYearCourse"/>
<courses
code="TDT4140"
name="Programvareutvikling"
credits="7.5"
level="IntermediateCourse"
season="Spring"/>
<courses
code="TDT4100"
name="Objektorientert programmering"
credits="7.5"
season="Spring"/>
</institutes>
<institutes
name="Institutt for matematiske fag">
<courses
code="MA1101"
name="Grunnkurs i analyse I"
credits="7.5"/>
<courses
code="MA1102"
name="Grunnkurs i analyse II"
credits="7.5"
season="Spring"/>
<courses
code="TMA4135"
name="Matematikk 4D"
credits="7.5"
level="ThirdYearCourse"/>
</institutes>
</spp:University>
<?xml version="1.0" encoding="UTF-8"?>
<spp:University
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spp="platform:/plugin/tdt4250.spp.model/model/spp.ecore"
xsi:schemaLocation="platform:/plugin/tdt4250.spp.model/model/spp.ecore spp.ecore"
name="NTNU">
<programs
name="Bachelor in IT">
<semesters
selectedCourses="//@institutes.0/@courses.0 //@institutes.0/@courses.7"/>
<semesters
season="Spring"
selectedCourses="//@institutes.0/@courses.4 //@institutes.1/@courses.5"/>
<semesters
year="2"
selectedCourses="//@institutes.0/@courses.5 //@institutes.1/@courses.2"/>
<mandatoryCourses
courses="//@institutes.0/@courses.0 //@institutes.0/@courses.3 //@institutes.0/@courses.4 //@institutes.0/@courses.5 //@institutes.0/@courses.7"/>
<electiveCourses
courses="//@institutes.0/@courses.1 //@institutes.0/@courses.2 //@institutes.0/@courses.6 //@institutes.1/@courses.3 //@institutes.1/@courses.4 //@institutes.1/@courses.5"/>
</programs>
<institutes
name="Institutt for datateknologi og informatikk">
<courses
code="TDT4110"
name="Informasjonsteknologi, grunnkurs"
credits="7.5"/>
<courses
code="TDT4250"
name="Avansert programvaredesign"
credits="7.5"
level="SecoundDegreeCourse"/>
<courses
code="TDT4175"
name="Informasjonssystemer"
credits="7.5"
level="ThirdYearCourse"/>
<courses
code="TDT4140"
name="Programvareutvikling"
credits="7.5"
level="IntermediateCourse"
season="Spring"/>
<courses
code="TDT4100"
name="Objektorientert programmering"
credits="7.5"
season="Spring"/>
<courses
code="TDT4120"
name="Algoritmer og datastrukturer"
credits="7.5"
level="IntermediateCourse"/>
<courses
code="IT2810"
name="Webutvikling"
credits="7.5"
level="IntermediateCourse"/>
<courses
code="IT2805"
name="Webteknologi"
credits="7.5"/>
</institutes>
<institutes
name="Institutt for matematiske fag">
<courses
code="MA1101"
name="Grunnkurs i analyse I"
credits="7.5"/>
<courses
code="MA1102"
name="Grunnkurs i analyse II"
credits="7.5"
season="Spring"/>
<courses
code="TMA4135"
name="Matematikk 4D"
credits="7.5"
level="ThirdYearCourse"/>
<courses
code="TMA4140"
name="Diskret matematikk"
credits="7.5"/>
<courses
code="MA1201"
name="Lineær algebra og geometri"
credits="7.5"/>
<courses
code="MA1103"
name="Flerdimensjonal analyse"
credits="7.5"
season="Spring"/>
</institutes>
<institutes
name="Institutt for lærerutdanning">
<courses
code="PPU4601 "
name="Pedagogikk 1"
credits="7.5"/>
<courses
code="PPU4611"
name="Praksis 1"/>
</institutes>
</spp:University>
......@@ -42,7 +42,7 @@
<details key="constraints" value="needsEnoughCredits coursesNeedsToBeMandatoryOrElectiveCourses"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/acceleo/query/1.0">
<details key="coursesNeedsToBeMandatoryOrElectiveCourses" value="((self.selectedCourses->intersection(self.eContainer().mandatoryCourses.courses))->notEmpty() or (self.selectedCourses->intersection(self.eContainer().electiveCourses.courses))->notEmpty()) or self.selectedCourses -> isEmpty()"/>
<details key="coursesNeedsToBeMandatoryOrElectiveCourses" value="((self.selectedCourses->intersection(self.eContainer().mandatoryCourses.courses))->notEmpty() or (self.selectedCourses->intersection(self.eContainer().electiveCourses.courses) -> notEmpty() or (self.selectedCourses -> intersection(self.eContainer().specialisation.mandatoryCourses -> union(self.eContainer().specialisation.electiveCourses)) -> notEmpty()) or self.selectedCourses -> isEmpty()"/>
</eAnnotations>
<eOperations name="getCredits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="semester" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"
......@@ -52,6 +52,8 @@
eOpposite="#//Program/semesters"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="selectedCourses" upperBound="-1"
eType="#//Course"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="specialization" upperBound="-1"
eType="#//Specialisation"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Course">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
......@@ -60,8 +62,8 @@
<eAnnotations source="http://www.eclipse.org/acceleo/query/1.0">
<details key="courseCodeNeedsToBeUnique" value="self.eContainer().eContainer().institutes.courses.code -> select(i: String | i = self.code) -> size() &lt; 2"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" eType="#//CourseCode"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" eType="#//CourseCode"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="credits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="level" eType="#//CourseLevelType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="season" eType="#//SeasonType"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment