API attendance (#24)

This commit is contained in:
Mikołaj Pich 2017-09-19 19:15:35 +02:00 committed by GitHub
parent aae3d5d357
commit c876d114e3
16 changed files with 1746 additions and 0 deletions

View File

@ -3,7 +3,9 @@ package io.github.wulkanowy.api;
public class Semester {
private String number = "";
private String id = "";
private boolean isCurrent = false;
public String getNumber() {

View File

@ -0,0 +1,34 @@
package io.github.wulkanowy.api.attendance;
import java.util.ArrayList;
import java.util.List;
public class Day {
private List<Lesson> lessons = new ArrayList<>();
private String date = "";
public Lesson getLesson(int index) {
return lessons.get(index);
}
public List<Lesson> getLessons() {
return lessons;
}
public Day setLesson(Lesson lesson) {
this.lessons.add(lesson);
return this;
}
public String getDate() {
return date;
}
public Day setDate(String date) {
this.date = date;
return this;
}
}

View File

@ -0,0 +1,120 @@
package io.github.wulkanowy.api.attendance;
public class Lesson {
protected static final String CLASS_NOT_EXIST = "x-sp-nieobecny-w-oddziale";
protected static final String CLASS_PRESENCE = "x-obecnosc";
protected static final String CLASS_ABSENCE_UNEXCUSED = "x-nieobecnosc-nieuspr";
protected static final String CLASS_ABSENCE_EXCUSED = "x-nieobecnosc-uspr";
protected static final String CLASS_ABSENCE_FOR_SCHOOL_REASONS = "x-nieobecnosc-przycz-szkol";
protected static final String CLASS_UNEXCUSED_LATENESS = "x-sp-nieusprawiedliwione";
protected static final String CLASS_EXCUSED_LATENESS = "x-sp-spr";
protected static final String CLASS_EXEMPTION = "x-sp-zwolnienie";
private String subject = "";
private boolean isNotExist = false;
private boolean isPresence = false;
private boolean isAbsenceUnexcused = false;
private boolean isAbsenceExcused = false;
private boolean isUnexcusedLateness = false;
private boolean isAbsenceForSchoolReasons = false;
private boolean isExcusedLateness = false;
private boolean isExemption = false;
private boolean isEmpty = false;
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public boolean isNotExist() {
return isNotExist;
}
public void setNotExist(boolean notExist) {
isNotExist = notExist;
}
public boolean isPresence() {
return isPresence;
}
public void setPresence(boolean presence) {
isPresence = presence;
}
public boolean isAbsenceUnexcused() {
return isAbsenceUnexcused;
}
public void setAbsenceUnexcused(boolean absenceUnexcused) {
isAbsenceUnexcused = absenceUnexcused;
}
public boolean isAbsenceExcused() {
return isAbsenceExcused;
}
public void setAbsenceExcused(boolean absenceExcused) {
isAbsenceExcused = absenceExcused;
}
public boolean isUnexcusedLateness() {
return isUnexcusedLateness;
}
public void setUnexcusedLateness(boolean unexcusedLateness) {
isUnexcusedLateness = unexcusedLateness;
}
public boolean isAbsenceForSchoolReasons() {
return isAbsenceForSchoolReasons;
}
public void setAbsenceForSchoolReasons(boolean absenceForSchoolReasons) {
isAbsenceForSchoolReasons = absenceForSchoolReasons;
}
public boolean isExcusedLateness() {
return isExcusedLateness;
}
public void setExcusedLateness(boolean excusedLateness) {
isExcusedLateness = excusedLateness;
}
public boolean isExemption() {
return isExemption;
}
public void setExemption(boolean exemption) {
isExemption = exemption;
}
public boolean isEmpty() {
return isEmpty;
}
public void setEmpty(boolean empty) {
isEmpty = empty;
}
}

View File

@ -0,0 +1,26 @@
package io.github.wulkanowy.api.attendance;
public class Month {
private String name = "";
private int value = 0;
public String getName() {
return name;
}
public Month setName(String name) {
this.name = name;
return this;
}
public int getValue() {
return value;
}
public Month setValue(int value) {
this.value = value;
return this;
}
}

View File

@ -0,0 +1,86 @@
package io.github.wulkanowy.api.attendance;
import org.apache.commons.lang3.math.NumberUtils;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import io.github.wulkanowy.api.StudentAndParent;
public class Statistics {
private StudentAndParent snp;
private String attendancePageUrl = "Frekwencja.mvc";
public Statistics(StudentAndParent snp) {
this.snp = snp;
}
public Types getTypesTable() throws IOException {
return getTypesTable("");
}
public Types getTypesTable(String tick) throws IOException {
return getTypesTable(tick, -1);
}
public List<Subject> getSubjectList() throws IOException {
Element mainContainer = snp.getSnPPageDocument(attendancePageUrl)
.select(".mainContainer #idPrzedmiot").first();
List<Subject> subjectList = new ArrayList<>();
for (Element subject : mainContainer.select("option")) {
subjectList.add(new Subject()
.setId(Integer.parseInt(subject.attr("value")))
.setName(subject.text())
);
}
return subjectList;
}
public Types getTypesTable(String tick, Integer subjectId) throws IOException {
Element mainContainer = snp.getSnPPageDocument((attendancePageUrl
+ "?data={tick}&idPrzedmiot={subject}")
.replace("{tick}", tick)
.replace("{subject}", subjectId.toString())
).select(".mainContainer").first();
Element table = mainContainer.select("table:nth-of-type(2)").first();
Elements headerCells = table.select("thead th");
List<Type> typeList = new ArrayList<>();
Elements typesRows = table.select("tbody tr");
// fill types with months
for (Element row : typesRows) {
Elements monthsCells = row.select("td");
List<Month> monthList = new ArrayList<>();
// iterate over month in type, first column is empty, last is `total`; (0, n-1)
for (int i = 1; i < monthsCells.size() - 1; i++) {
monthList.add(new Month()
.setValue(NumberUtils.toInt(monthsCells.get(i).text(), 0))
.setName(headerCells.get(i).text()));
}
typeList.add(new Type()
.setTotal(NumberUtils.toInt(monthsCells.last().text(), 0))
.setName(monthsCells.get(0).text())
.setMonthList(monthList));
}
String total = mainContainer.select("h2").text().split(": ")[1];
return new Types()
.setTotal(NumberUtils.toDouble(total.replace("%", "").replace(",", ".")))
.setTypeList(typeList);
}
}

View File

@ -0,0 +1,26 @@
package io.github.wulkanowy.api.attendance;
public class Subject {
private int id = -1;
private String name = "";
public int getId() {
return id;
}
public Subject setId(int id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public Subject setName(String name) {
this.name = name;
return this;
}
}

View File

@ -0,0 +1,98 @@
package io.github.wulkanowy.api.attendance;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import io.github.wulkanowy.api.StudentAndParent;
public class Table {
private StudentAndParent snp;
private String attendancePageUrl = "Frekwencja.mvc?data=";
public Table(StudentAndParent snp) {
this.snp = snp;
}
public Week getWeekTable() throws IOException {
return getWeekTable("");
}
public Week getWeekTable(String tick) throws IOException {
Element table = snp.getSnPPageDocument(attendancePageUrl + tick)
.select(".mainContainer .presentData").first();
Elements headerCells = table.select("thead th");
List<Day> days = new ArrayList<>();
for (int i = 1; i < headerCells.size(); i++) {
days.add(new Day().setDate(headerCells.get(i).html().split("<br>")[1]));
}
Elements hoursInDays = table.select("tbody tr");
// fill days in week with lessons
for (Element row : hoursInDays) {
Elements hours = row.select("td");
// fill hours in day
int size = hours.size();
for (int i = 1; i < size; i++) {
days.get(i - 1).setLesson(getNewLesson(hours.get(i)));
}
}
String[] dayDescription = headerCells.get(1).html().split("<br>");
return new Week()
.setStartDayDate(dayDescription[1])
.setDays(days);
}
private Lesson getNewLesson(Element cell) {
Lesson lesson = new Lesson();
lesson.setSubject(cell.select("span").text());
if (Lesson.CLASS_NOT_EXIST.equals(cell.attr("class"))) {
lesson.setNotExist(true);
lesson.setEmpty(true);
return lesson;
}
switch (cell.select("div").attr("class")) {
case Lesson.CLASS_PRESENCE:
lesson.setPresence(true);
break;
case Lesson.CLASS_ABSENCE_UNEXCUSED:
lesson.setAbsenceUnexcused(true);
break;
case Lesson.CLASS_ABSENCE_EXCUSED:
lesson.setAbsenceExcused(true);
break;
case Lesson.CLASS_ABSENCE_FOR_SCHOOL_REASONS:
lesson.setAbsenceForSchoolReasons(true);
break;
case Lesson.CLASS_UNEXCUSED_LATENESS:
lesson.setUnexcusedLateness(true);
break;
case Lesson.CLASS_EXCUSED_LATENESS:
lesson.setExcusedLateness(true);
break;
case Lesson.CLASS_EXEMPTION:
lesson.setExemption(true);
break;
default:
lesson.setEmpty(true);
break;
}
return lesson;
}
}

View File

@ -0,0 +1,40 @@
package io.github.wulkanowy.api.attendance;
import java.util.ArrayList;
import java.util.List;
public class Type {
private String name = "";
private int total = 0;
private List<Month> monthList = new ArrayList<>();
public String getName() {
return name;
}
public Type setName(String name) {
this.name = name;
return this;
}
public int getTotal() {
return total;
}
public Type setTotal(int total) {
this.total = total;
return this;
}
public List<Month> getMonthList() {
return monthList;
}
public Type setMonthList(List<Month> monthList) {
this.monthList = monthList;
return this;
}
}

View File

@ -0,0 +1,29 @@
package io.github.wulkanowy.api.attendance;
import java.util.ArrayList;
import java.util.List;
public class Types {
private double total = 0;
private List<Type> typeList = new ArrayList<>();
public double getTotal() {
return total;
}
public Types setTotal(double total) {
this.total = total;
return this;
}
public List<Type> getTypeList() {
return typeList;
}
public Types setTypeList(List<Type> typeList) {
this.typeList = typeList;
return this;
}
}

View File

@ -0,0 +1,33 @@
package io.github.wulkanowy.api.attendance;
import java.util.ArrayList;
import java.util.List;
public class Week {
private List<Day> days = new ArrayList<>();
private String startDayDate = "";
public Day getDay(int index) {
return days.get(index);
}
public List<Day> getDays() {
return days;
}
public Week setDays(List<Day> days) {
this.days = days;
return this;
}
public String getStartDayDate() {
return startDayDate;
}
public Week setStartDayDate(String startDayDate) {
this.startDayDate = startDayDate;
return this;
}
}

View File

@ -3,9 +3,13 @@ package io.github.wulkanowy.api.school;
public class SchoolData {
private String name = "";
private String address = "";
private String phoneNumber = "";
private String headmaster = "";
private String[] pedagogue;
public String getName() {

View File

@ -1,7 +1,9 @@
package io.github.wulkanowy.api.school;
public class Subject {
private String name = "";
private String[] teachers;
public String getName() {

View File

@ -0,0 +1,159 @@
package io.github.wulkanowy.api.attendance;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import java.util.List;
import io.github.wulkanowy.api.FixtureHelper;
import io.github.wulkanowy.api.StudentAndParent;
public class StatisticsTest {
private Statistics excellent;
private Statistics full;
@Before
public void setUp() throws Exception {
this.excellent = getSetUpTable("Frekwencja-excellent.html");
this.full = getSetUpTable("Frekwencja-full.html");
}
private Statistics getSetUpTable(String fixtureFileName) throws Exception {
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
Document tablePageDocument = Jsoup.parse(input);
StudentAndParent timetable = Mockito.mock(StudentAndParent.class);
Mockito.when(timetable.getSnPPageDocument(Mockito.anyString()))
.thenReturn(tablePageDocument);
return new Statistics(timetable);
}
@Test
public void getSubjectList() throws Exception {
Assert.assertEquals(26, excellent.getSubjectList().size());
Assert.assertEquals(23, full.getSubjectList().size());
}
@Test
public void getSubjectListId() throws Exception {
Assert.assertEquals(-1, excellent.getSubjectList().get(0).getId());
Assert.assertEquals(63, excellent.getSubjectList().get(10).getId());
Assert.assertEquals(0, excellent.getSubjectList().get(25).getId());
Assert.assertEquals(-1, full.getSubjectList().get(0).getId());
Assert.assertEquals(108, full.getSubjectList().get(14).getId());
Assert.assertEquals(492, full.getSubjectList().get(21).getId());
}
@Test
public void getSubjectListName() throws Exception {
Assert.assertEquals("Wszystkie", excellent.getSubjectList().get(0).getName());
Assert.assertEquals("Fizyka", excellent.getSubjectList().get(8).getName());
Assert.assertEquals("Sieci komputerowe i administrowanie sieciami",
excellent.getSubjectList().get(21).getName());
Assert.assertEquals("Praktyka zawodowa", full.getSubjectList().get(11).getName());
Assert.assertEquals("Użytkowanie urządzeń peryferyjnych komputera",
full.getSubjectList().get(16).getName());
Assert.assertEquals("Brak opisu lekcji", full.getSubjectList().get(22).getName());
}
@Test
public void getTypesTotal() throws Exception {
Assert.assertEquals(100.0, excellent.getTypesTable().getTotal(), 0);
Assert.assertEquals(80.94, full.getTypesTable().getTotal(), 0);
}
@Test
public void getTypeName() throws Exception {
List<Type> typeList1 = excellent.getTypesTable().getTypeList();
Assert.assertEquals("Obecność", typeList1.get(0).getName());
Assert.assertEquals("Nieobecność nieusprawiedliwiona", typeList1.get(1).getName());
Assert.assertEquals("Nieobecność usprawiedliwiona", typeList1.get(2).getName());
Assert.assertEquals("Nieobecność z przyczyn szkolnych", typeList1.get(3).getName());
List<Type> typeList2 = full.getTypesTable().getTypeList();
Assert.assertEquals("Spóźnienie nieusprawiedliwione", typeList2.get(4).getName());
Assert.assertEquals("Spóźnienie usprawiedliwione", typeList2.get(5).getName());
Assert.assertEquals("Zwolnienie", typeList2.get(6).getName());
}
@Test
public void getTypeTotal() throws Exception {
List<Type> typeList1 = excellent.getTypesTable().getTypeList();
Assert.assertEquals(1211, typeList1.get(0).getTotal());
Assert.assertEquals(0, typeList1.get(1).getTotal());
Assert.assertEquals(0, typeList1.get(2).getTotal());
Assert.assertEquals(0, typeList1.get(3).getTotal());
Assert.assertEquals(0, typeList1.get(4).getTotal());
Assert.assertEquals(0, typeList1.get(5).getTotal());
Assert.assertEquals(0, typeList1.get(6).getTotal());
List<Type> typeList2 = full.getTypesTable().getTypeList();
Assert.assertEquals(822, typeList2.get(0).getTotal());
Assert.assertEquals(6, typeList2.get(1).getTotal());
Assert.assertEquals(192, typeList2.get(2).getTotal());
Assert.assertEquals(7, typeList2.get(3).getTotal());
Assert.assertEquals(12, typeList2.get(4).getTotal());
Assert.assertEquals(1, typeList2.get(5).getTotal());
Assert.assertEquals(2, typeList2.get(6).getTotal());
}
@Test
public void getTypeList() throws Exception {
List<Type> typesList1 = excellent.getTypesTable().getTypeList();
Assert.assertEquals(12, typesList1.get(0).getMonthList().size());
Assert.assertEquals(12, typesList1.get(5).getMonthList().size());
List<Type> typesList2 = full.getTypesTable().getTypeList();
Assert.assertEquals(12, typesList2.get(0).getMonthList().size());
Assert.assertEquals(12, typesList2.get(5).getMonthList().size());
}
@Test
public void getMonthList() throws Exception {
List<Type> typeList1 = excellent.getTypesTable().getTypeList();
Assert.assertEquals(12, typeList1.get(0).getMonthList().size());
List<Type> typeList2 = full.getTypesTable().getTypeList();
Assert.assertEquals(12, typeList2.get(0).getMonthList().size());
}
@Test
public void getMonthName() throws Exception {
List<Month> monthsList1 = excellent.getTypesTable().getTypeList().get(0).getMonthList();
Assert.assertEquals("IX", monthsList1.get(0).getName());
Assert.assertEquals("III", monthsList1.get(6).getName());
Assert.assertEquals("VIII", monthsList1.get(11).getName());
List<Month> monthsList2 = full.getTypesTable().getTypeList().get(0).getMonthList();
Assert.assertEquals("XI", monthsList2.get(2).getName());
Assert.assertEquals("II", monthsList2.get(5).getName());
Assert.assertEquals("VI", monthsList2.get(9).getName());
}
@Test
public void getMonthValue() throws Exception {
List<Month> monthsList1 = excellent.getTypesTable().getTypeList().get(0).getMonthList();
Assert.assertEquals(142, monthsList1.get(0).getValue());
Assert.assertEquals(131, monthsList1.get(4).getValue());
Assert.assertEquals(139, monthsList1.get(7).getValue());
Assert.assertEquals(114, monthsList1.get(9).getValue());
Assert.assertEquals(0, monthsList1.get(11).getValue());
List<Type> typeList1 = full.getTypesTable().getTypeList();
Assert.assertEquals(135, typeList1.get(0).getMonthList().get(0).getValue());
Assert.assertEquals(7, typeList1.get(3).getMonthList().get(5).getValue());
Assert.assertEquals(1, typeList1.get(5).getMonthList().get(0).getValue());
Assert.assertEquals(27, typeList1.get(2).getMonthList().get(9).getValue());
Assert.assertEquals(0, typeList1.get(0).getMonthList().get(11).getValue());
}
}

View File

@ -0,0 +1,181 @@
package io.github.wulkanowy.api.attendance;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import io.github.wulkanowy.api.FixtureHelper;
import io.github.wulkanowy.api.StudentAndParent;
public class TableTest {
private Table excellent;
private Table full;
@Before
public void setUp() throws Exception {
excellent = getSetUpTable("Frekwencja-excellent.html");
full = getSetUpTable("Frekwencja-full.html");
}
public Table getSetUpTable(String fixtureFileName) throws Exception {
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
Document tablePageDocument = Jsoup.parse(input);
StudentAndParent timetable = Mockito.mock(StudentAndParent.class);
Mockito.when(timetable.getSnPPageDocument(Mockito.anyString()))
.thenReturn(tablePageDocument);
return new Table(timetable);
}
@Test
public void getWeekStartByDate() throws Exception {
Assert.assertEquals("31.08.2015", excellent.getWeekTable().getStartDayDate());
Assert.assertEquals("05.09.2016", full.getWeekTable().getStartDayDate());
}
@Test
public void getWeekDaysNumber() throws Exception {
Assert.assertEquals(5, excellent.getWeekTable().getDays().size());
Assert.assertEquals(5, full.getWeekTable().getDays().size());
}
@Test
public void getDayLessonsNumber() throws Exception {
Assert.assertEquals(14, excellent.getWeekTable().getDay(0).getLessons().size());
Assert.assertEquals(14, full.getWeekTable().getDay(0).getLessons().size());
}
@Test
public void getDayDate() throws Exception {
Assert.assertEquals("31.08.2015", excellent.getWeekTable().getDay(0).getDate());
Assert.assertEquals("02.09.2015", excellent.getWeekTable().getDay(2).getDate());
Assert.assertEquals("04.09.2015", excellent.getWeekTable().getDay(4).getDate());
Assert.assertEquals("05.09.2016", full.getWeekTable().getDay(0).getDate());
Assert.assertEquals("07.09.2016", full.getWeekTable().getDay(2).getDate());
Assert.assertEquals("09.09.2016", full.getWeekTable().getDay(4).getDate());
}
@Test
public void getLessonSubject() throws Exception {
Assert.assertEquals("",
excellent.getWeekTable().getDay(0).getLesson(7).getSubject());
Assert.assertEquals("Uroczyste rozpoczęcie roku szkolnego 2015/2016",
excellent.getWeekTable().getDay(1).getLesson(1).getSubject());
Assert.assertEquals("Geografia",
excellent.getWeekTable().getDay(3).getLesson(4).getSubject());
Assert.assertEquals("Naprawa komputera",
full.getWeekTable().getDay(1).getLesson(8).getSubject());
Assert.assertEquals("Religia",
full.getWeekTable().getDay(3).getLesson(1).getSubject());
Assert.assertEquals("Metodologia programowania",
full.getWeekTable().getDay(4).getLesson(5).getSubject());
}
@Test
public void getLessonIsNotExist() throws Exception {
Assert.assertTrue(excellent.getWeekTable().getDay(0).getLesson(5).isNotExist());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(1).isNotExist());
Assert.assertFalse(excellent.getWeekTable().getDay(4).getLesson(12).isNotExist());
Assert.assertFalse(full.getWeekTable().getDay(1).getLesson(12).isAbsenceUnexcused());
Assert.assertFalse(full.getWeekTable().getDay(3).getLesson(1).isAbsenceUnexcused());
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(5).isAbsenceUnexcused());
}
@Test
public void getLessonIsEmpty() throws Exception {
Assert.assertTrue(excellent.getWeekTable().getDay(0).getLesson(0).isEmpty());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(6).isEmpty());
Assert.assertTrue(excellent.getWeekTable().getDay(4).getLesson(12).isEmpty());
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(9).isEmpty());
Assert.assertFalse(full.getWeekTable().getDay(2).getLesson(5).isEmpty());
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(2).isEmpty());
}
@Test
public void getLessonIsPresence() throws Exception {
Assert.assertFalse(excellent.getWeekTable().getDay(0).getLesson(7).isPresence());
Assert.assertTrue(excellent.getWeekTable().getDay(1).getLesson(1).isPresence());
Assert.assertTrue(excellent.getWeekTable().getDay(3).getLesson(7).isPresence());
Assert.assertTrue(full.getWeekTable().getDay(0).getLesson(1).isPresence());
Assert.assertTrue(full.getWeekTable().getDay(2).getLesson(6).isPresence());
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(7).isPresence());
}
@Test
public void getLessonIsAbsenceUnexcused() throws Exception {
Assert.assertFalse(excellent.getWeekTable().getDay(0).getLesson(7).isAbsenceUnexcused());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(0).isAbsenceUnexcused());
Assert.assertFalse(excellent.getWeekTable().getDay(4).getLesson(4).isAbsenceUnexcused());
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(8).isAbsenceUnexcused());
Assert.assertFalse(full.getWeekTable().getDay(3).getLesson(1).isAbsenceUnexcused());
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(8).isAbsenceUnexcused());
}
@Test
public void getLessonIsAbsenceExcused() throws Exception {
Assert.assertFalse(excellent.getWeekTable().getDay(0).getLesson(7).isAbsenceExcused());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(0).isAbsenceExcused());
Assert.assertFalse(excellent.getWeekTable().getDay(4).getLesson(4).isAbsenceExcused());
Assert.assertFalse(full.getWeekTable().getDay(2).getLesson(5).isAbsenceExcused());
Assert.assertFalse(full.getWeekTable().getDay(3).getLesson(1).isAbsenceExcused());
Assert.assertTrue(full.getWeekTable().getDay(4).getLesson(3).isAbsenceExcused());
}
@Test
public void getLessonIsAbsenceForSchoolReasons() throws Exception {
Assert.assertFalse(excellent.getWeekTable().getDay(0).getLesson(4).isAbsenceForSchoolReasons());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(8).isAbsenceForSchoolReasons());
Assert.assertFalse(excellent.getWeekTable().getDay(4).getLesson(12).isAbsenceForSchoolReasons());
Assert.assertTrue(full.getWeekTable().getDay(2).getLesson(5).isAbsenceForSchoolReasons());
Assert.assertFalse(full.getWeekTable().getDay(3).getLesson(1).isAbsenceForSchoolReasons());
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(8).isAbsenceForSchoolReasons());
}
@Test
public void getLessonIsUnexcusedLateness() throws Exception {
Assert.assertFalse(excellent.getWeekTable().getDay(0).getLesson(4).isUnexcusedLateness());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(8).isUnexcusedLateness());
Assert.assertFalse(excellent.getWeekTable().getDay(4).getLesson(12).isUnexcusedLateness());
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(6).isUnexcusedLateness());
Assert.assertFalse(full.getWeekTable().getDay(3).getLesson(1).isUnexcusedLateness());
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(8).isUnexcusedLateness());
}
@Test
public void getLessonIsExcusedLateness() throws Exception {
Assert.assertFalse(excellent.getWeekTable().getDay(0).getLesson(4).isExcusedLateness());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(8).isExcusedLateness());
Assert.assertFalse(excellent.getWeekTable().getDay(4).getLesson(12).isExcusedLateness());
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(7).isExcusedLateness());
Assert.assertFalse(full.getWeekTable().getDay(3).getLesson(1).isExcusedLateness());
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(8).isExcusedLateness());
}
@Test
public void getLessonIsExemption() throws Exception {
Assert.assertFalse(excellent.getWeekTable().getDay(0).getLesson(4).isExemption());
Assert.assertFalse(excellent.getWeekTable().getDay(2).getLesson(8).isExemption());
Assert.assertFalse(excellent.getWeekTable().getDay(4).getLesson(12).isExemption());
Assert.assertFalse(full.getWeekTable().getDay(2).getLesson(5).isExemption());
Assert.assertFalse(full.getWeekTable().getDay(3).getLesson(1).isExemption());
Assert.assertTrue(full.getWeekTable().getDay(4).getLesson(8).isExemption());
}
}

View File

@ -0,0 +1,408 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Witryna ucznia i rodzica Frekwencja</title>
<style>
.x-sp-nieobecny-w-oddziale:before {
content: 'nieobecny w oddziale';
background: grey;
}
.x-obecnosc:before {
content: 'obecność';
background: green;
}
.presentData td:not(.padding-zero):not(.x-sp-nieobecny-w-oddziale):not(:first-child):before {
content: 'pusta';
background: grey;
}
</style>
</head>
<body>
<main class="mainContainer">
<h1>Frekwencja</h1>
<table class="presentData">
<thead>
<tr>
<th>Lekcja</th>
<th>poniedziałek<br>31.08.2015</th>
<th>wtorek<br>01.09.2015</th>
<th>środa<br>02.09.2015</th>
<th>czwartek<br>03.09.2015</th>
<th>piątek<br>04.09.2015</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Uroczyste rozpoczęcie roku szkolnego 2015/2016</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Wychowanie do życia w rodzinie</span>
</div>
</td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
</tr>
<tr>
<td>2</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język angielski</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język niemiecki</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
</tr>
<tr>
<td>3</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Systemy operacyjne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Chemia</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
</tr>
<tr>
<td>4</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Systemy operacyjne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Geografia</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
</tr>
<tr>
<td>5</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Tworzenie stron internetowych</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Matematyka</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język polski</span>
</div>
</td>
</tr>
<tr>
<td>6</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Tworzenie stron internetowych</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Fizyka</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Matematyka</span>
</div>
</td>
</tr>
<tr>
<td>7</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Wychowanie fizyczne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język polski</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Historia</span>
</div>
</td>
</tr>
<tr>
<td>8</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Wychowanie fizyczne</span>
</div>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>9</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>10</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>11</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>12</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>13</td>
<td class="x-sp-nieobecny-w-oddziale"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h1 id="statystyki">Statystyki</h1>
<div>
<label for="idPrzedmiot">Przedmiot:</label>
<select id="idPrzedmiot" name="idPrzedmiot">
<option value="-1">Wszystkie</option>
<option value="1">Religia</option>
<option value="4">Język polski</option>
<option value="5">Język angielski</option>
<option value="9">Język niemiecki</option>
<option value="50">Historia</option>
<option value="56">Wiedza o społeczeństwie</option>
<option value="58">Matematyka</option>
<option value="59">Fizyka</option>
<option value="61">Chemia</option>
<option value="63">Biologia</option>
<option value="64">Geografia</option>
<option value="71">Informatyka</option>
<option value="75">Wychowanie fizyczne</option>
<option value="88">Edukacja dla bezpieczeństwa</option>
<option value="91">Wychowanie do życia w rodzinie</option>
<option value="94">Zajęcia z wychowawcą</option>
<option value="106">Techniki biurowe</option>
<option value="108">Urządzenia techniki komputerowej</option>
<option value="109">Naprawa komputera</option>
<option value="113">Systemy operacyjne</option>
<option value="114">Sieci komputerowe i administrowanie sieciami</option>
<option value="118">Tworzenie stron internetowych</option>
<option value="492">Opieka nad uczniami</option>
<option value="664">Fizyka doświadczalna</option>
<option value="0">Brak opisu lekcji</option>
</select>
</div>
<h2>Frekwencja od początku roku szkolnego: 100,00%</h2>
<table>
<thead>
<tr>
<th></th>
<th>IX</th>
<th>X</th>
<th>XI</th>
<th>XII</th>
<th>I</th>
<th>II</th>
<th>III</th>
<th>IV</th>
<th>V</th>
<th>VI</th>
<th>VII</th>
<th>VIII</th>
<th>Razem</th>
</tr>
</thead>
<tbody>
<tr>
<td>Obecność</td>
<td>142</td>
<td>143</td>
<td>139</td>
<td>110</td>
<td>131</td>
<td>75</td>
<td>126</td>
<td>139</td>
<td>92</td>
<td>114</td>
<td></td>
<td></td>
<td>1211</td>
</tr>
<tr>
<td>Nieobecność nieusprawiedliwiona</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Nieobecność usprawiedliwiona</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Nieobecność z przyczyn szkolnych</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Spóźnienie nieusprawiedliwione</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Spóźnienie usprawiedliwione</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Zwolnienie</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</main>
<footer>wersja: 17.07.0002.24480</footer>
</body>
</html>

View File

@ -0,0 +1,498 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Witryna ucznia i rodzica Frekwencja</title>
<style>
.x-obecnosc:before {
content: 'obecność';
background: green;
}
.x-nieobecnosc-nieuspr:before {
content: 'nieobecność nieusprawiedliwiona';
background: red;
}
.x-nieobecnosc-uspr:before {
content: 'nieobecność usprawiedliwiona';
background: orange;
}
.x-nieobecnosc-przycz-szkol:before {
content: 'nieobecność z przyczyn szkolnych';
background: lightblue;
}
.x-sp-nieusprawiedliwione:before {
content: 'spóźnienie nieusprawiedliwione';
background: yellow;
}
.x-sp-spr:before {
content: 'spóźnienie usprawiedliwione';
background: black;
color: white;
}
.x-sp-zwolnienie:before {
content: 'zwolnienie';
background: purple;
}
.x-sp-nieobecny-w-oddziale:before {
content: 'nieobecny w oddziale';
background: grey;
}
.x-obecnosc:before {
content: 'obecność';
background: green;
}
.presentData td:not(.padding-zero):not(.x-sp-nieobecny-w-oddziale):not(:first-child):before {
content: 'pusta';
background: grey;
}
</style>
</head>
<body>
<main class="mainContainer">
<h1>Frekwencja</h1>
<table class="presentData">
<thead>
<tr>
<th>Lekcja</th>
<th>poniedziałek<br>05.09.2016</th>
<th>wtorek<br>06.09.2016</th>
<th>środa<br>07.09.2016</th>
<th>czwartek<br>08.09.2016</th>
<th>piątek<br>09.09.2016</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Multimedia i grafika komputerowa</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Użytkowanie urządzeń peryferyjnych komputera</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Religia</span>
</div>
</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język niemiecki</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Użytkowanie urządzeń peryferyjnych komputera</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język niemiecki</span>
</div>
</td>
<td class="padding-zero">
<div class="x-nieobecnosc-uspr">
<span>Sieci komputerowe i administrowanie sieciami</span>
</div>
</td>
</tr>
<tr>
<td>3</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Fizyka</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Historia</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Wychowanie fizyczne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-nieobecnosc-uspr">
<span>Wiedza o kulturze</span>
</div>
</td>
</tr>
<tr>
<td>4</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Naprawa komputera</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Wychowanie fizyczne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język angielski</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Wychowanie fizyczne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-nieobecnosc-uspr">
<span>Język polski</span>
</div>
</td>
</tr>
<tr>
<td>5</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Sieci komputerowe i administrowanie sieciami</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Metodologia programowania</span>
</div>
</td>
<td class="padding-zero">
<div class="x-nieobecnosc-przycz-szkol">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Matematyka</span>
</div>
</td>
<td class="padding-zero">
<div class="x-nieobecnosc-uspr">
<span>Metodologia programowania</span>
</div>
</td>
</tr>
<tr>
<td>6</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język niemiecki</span>
</div>
</td>
<td class="padding-zero">
<div class="x-sp-nieusprawiedliwione">
<span>Sieci komputerowe i administrowanie sieciami</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Język polski</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Podstawy przedsiębiorczości</span>
</div>
</td>
<td class="padding-zero">
<div class="x-nieobecnosc-uspr">
<span>Matematyka</span>
</div>
</td>
</tr>
<tr>
<td>7</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Fizyka</span>
</div>
</td>
<td class="padding-zero">
<div class="x-sp-spr">
<span>Język polski</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Systemy operacyjne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Zajęcia z wychowawcą</span>
</div>
</td>
<td class="padding-zero">
<div class="x-nieobecnosc-uspr">
<span>Religia</span>
</div>
</td>
</tr>
<tr>
<td>8</td>
<td></td>
<td class="padding-zero">
<div class="x-nieobecnosc-nieuspr">
<span>Naprawa komputera</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Systemy operacyjne</span>
</div>
</td>
<td class="padding-zero">
<div class="x-obecnosc">
<span>Urządzenia techniki komputerowej</span>
</div>
</td>
<td class="padding-zero">
<div class="x-sp-zwolnienie">
<span>Zajęcia z wychowawcą</span>
</div>
</td>
</tr>
<tr>
<td>9</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>10</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>11</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>12</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>13</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h1 id="statystyki">Statystyki</h1>
<div>
<label for="idPrzedmiot">Przedmiot:</label>
<select id="idPrzedmiot" name="idPrzedmiot">
<option value="-1">Wszystkie</option>
<option value="1">Religia</option>
<option value="4">Język polski</option>
<option value="5">Język angielski</option>
<option value="9">Język niemiecki</option>
<option value="50">Historia</option>
<option value="57">Wiedza o kulturze</option>
<option value="58">Matematyka</option>
<option value="59">Fizyka</option>
<option value="70">Podstawy przedsiębiorczości</option>
<option value="75">Wychowanie fizyczne</option>
<option value="77">Praktyka zawodowa</option>
<option value="91">Wychowanie do życia w rodzinie</option>
<option value="94">Zajęcia z wychowawcą</option>
<option value="108">Urządzenia techniki komputerowej</option>
<option value="109">Naprawa komputera</option>
<option value="110">Użytkowanie urządzeń peryferyjnych komputera</option>
<option value="113">Systemy operacyjne</option>
<option value="114">Sieci komputerowe i administrowanie sieciami</option>
<option value="116">Multimedia i grafika komputerowa</option>
<option value="120">Metodologia programowania</option>
<option value="492">Opieka nad uczniami</option>
<option value="0">Brak opisu lekcji</option>
</select>
</div>
<h2>Frekwencja od początku roku szkolnego: 80,94%</h2>
<table>
<thead>
<tr>
<th></th>
<th>IX</th>
<th>X</th>
<th>XI</th>
<th>XII</th>
<th>I</th>
<th>II</th>
<th>III</th>
<th>IV</th>
<th>V</th>
<th>VI</th>
<th>VII</th>
<th>VIII</th>
<th>Razem</th>
</tr>
</thead>
<tbody>
<tr>
<td>Obecność</td>
<td>135</td>
<td>103</td>
<td>108</td>
<td>54</td>
<td>37</td>
<td>100</td>
<td>33</td>
<td>90</td>
<td>103</td>
<td>59</td>
<td></td>
<td></td>
<td>822</td>
</tr>
<tr>
<td>Nieobecność nieusprawiedliwiona</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>2</td>
<td></td>
<td></td>
<td></td>
<td>4</td>
<td></td>
<td></td>
<td>6</td>
</tr>
<tr>
<td>Nieobecność usprawiedliwiona</td>
<td>6</td>
<td>27</td>
<td>29</td>
<td>30</td>
<td>44</td>
<td></td>
<td></td>
<td>16</td>
<td>13</td>
<td>27</td>
<td></td>
<td></td>
<td>192</td>
</tr>
<tr>
<td>Nieobecność z przyczyn szkolnych</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>7</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>7</td>
</tr>
<tr>
<td>Spóźnienie nieusprawiedliwione</td>
<td>4</td>
<td></td>
<td>1</td>
<td></td>
<td></td>
<td>2</td>
<td>2</td>
<td></td>
<td>2</td>
<td>1</td>
<td></td>
<td></td>
<td>12</td>
</tr>
<tr>
<td>Spóźnienie usprawiedliwione</td>
<td>1</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>1</td>
</tr>
<tr>
<td>Zwolnienie</td>
<td></td>
<td>1</td>
<td></td>
<td></td>
<td></td>
<td>1</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>2</td>
</tr>
</tbody>
</table>
</main>
<footer>wersja: 17.07.0002.24480</footer>
</body>
</html>