forked from github/wulkanowy-mirror
Change all entities ids from string to int (#167)
This commit is contained in:
parent
27f6fc7e04
commit
f35d9d4b93
@ -72,7 +72,7 @@ ext.supportVersion = "28.0.0"
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation('com.github.wulkanowy:api:a5667f8000') { exclude module: "threetenbp" }
|
||||
implementation('com.github.wulkanowy:api:1400211f0d') { exclude module: "threetenbp" }
|
||||
|
||||
implementation "com.android.support:support-v4:$supportVersion"
|
||||
implementation "com.android.support:appcompat-v7:$supportVersion"
|
||||
|
@ -34,13 +34,13 @@ class AttendanceLocalTest {
|
||||
@Test
|
||||
fun saveAndReadTest() {
|
||||
attendanceLocal.saveAttendance(listOf(
|
||||
Attendance("1", "2", LocalDate.of(2018, 9, 10), 0, "", ""),
|
||||
Attendance("1", "2", LocalDate.of(2018, 9, 14), 0, "", ""),
|
||||
Attendance("1", "2", LocalDate.of(2018, 9, 17), 0, "", "")
|
||||
Attendance(1, 2, LocalDate.of(2018, 9, 10), 0, "", ""),
|
||||
Attendance(1, 2, LocalDate.of(2018, 9, 14), 0, "", ""),
|
||||
Attendance(1, 2, LocalDate.of(2018, 9, 17), 0, "", "")
|
||||
))
|
||||
|
||||
val attendance = attendanceLocal
|
||||
.getAttendance(Semester(1, "1", "2", "", "3", 1),
|
||||
.getAttendance(Semester(1, 1, 2, "", 3, 1),
|
||||
LocalDate.of(2018, 9, 10),
|
||||
LocalDate.of(2018, 9, 14)
|
||||
)
|
||||
|
@ -34,13 +34,13 @@ class ExamLocalTest {
|
||||
@Test
|
||||
fun saveAndReadTest() {
|
||||
examLocal.saveExams(listOf(
|
||||
Exam("1", "2", LocalDate.of(2018, 9, 10), LocalDate.now(), "", "", "", "", "", ""),
|
||||
Exam("1", "2", LocalDate.of(2018, 9, 14), LocalDate.now(), "", "", "", "", "", ""),
|
||||
Exam("1", "2", LocalDate.of(2018, 9, 17), LocalDate.now(), "", "", "", "", "", "")
|
||||
Exam(1, 2, LocalDate.of(2018, 9, 10), LocalDate.now(), "", "", "", "", "", ""),
|
||||
Exam(1, 2, LocalDate.of(2018, 9, 14), LocalDate.now(), "", "", "", "", "", ""),
|
||||
Exam(1, 2, LocalDate.of(2018, 9, 17), LocalDate.now(), "", "", "", "", "", "")
|
||||
))
|
||||
|
||||
val exams = examLocal
|
||||
.getExams(Semester(1, "1", "2", "", "3", 1),
|
||||
.getExams(Semester(1, 1, 2, "", 3, 1),
|
||||
LocalDate.of(2018, 9, 10),
|
||||
LocalDate.of(2018, 9, 14)
|
||||
)
|
||||
|
@ -38,12 +38,12 @@ class SessionLocalTest {
|
||||
|
||||
@Test
|
||||
fun saveAndReadTest() {
|
||||
sessionLocal.saveStudent(Student(email = "test", password = "test123", schoolId = "23", endpoint = "fakelog.cf", loginType = "AUTO")).blockingAwait()
|
||||
sessionLocal.saveStudent(Student(email = "test", password = "test123", schoolSymbol = "23", endpoint = "fakelog.cf", loginType = "AUTO")).blockingAwait()
|
||||
assert(sharedHelper.getLong(SessionLocal.LAST_USER_KEY, 0) == 1L)
|
||||
|
||||
assert(sessionLocal.isSessionSaved)
|
||||
|
||||
val student = sessionLocal.getLastStudent().blockingGet()
|
||||
assertEquals("23", student.schoolId)
|
||||
assertEquals("23", student.schoolSymbol)
|
||||
}
|
||||
}
|
||||
|
@ -35,16 +35,16 @@ class TimetableLocalTest {
|
||||
@Test
|
||||
fun saveAndReadTest() {
|
||||
timetableDb.saveTimetable(listOf(
|
||||
Timetable("1", "2", 1, LocalDateTime.now(), LocalDateTime.now(),
|
||||
Timetable(1, 2, 1, LocalDateTime.now(), LocalDateTime.now(),
|
||||
LocalDate.of(2018, 9, 10), "", "", "", "", ""),
|
||||
Timetable("1", "2", 1, LocalDateTime.now(), LocalDateTime.now(),
|
||||
Timetable(1, 2, 1, LocalDateTime.now(), LocalDateTime.now(),
|
||||
LocalDate.of(2018, 9, 14), "", "", "", "", ""),
|
||||
Timetable("1", "2", 1, LocalDateTime.now(), LocalDateTime.now(),
|
||||
Timetable(1, 2, 1, LocalDateTime.now(), LocalDateTime.now(),
|
||||
LocalDate.of(2018, 9, 17), "", "", "", "", "")
|
||||
))
|
||||
|
||||
val exams = timetableDb.getTimetable(
|
||||
Semester(0, "1", "2", "3", "", 1),
|
||||
Semester(0, 1, 2, "3", 1, 1),
|
||||
LocalDate.of(2018, 9, 10),
|
||||
LocalDate.of(2018, 9, 14)
|
||||
).blockingGet()
|
||||
|
@ -18,5 +18,5 @@ interface AttendanceDao {
|
||||
fun deleteAll(exams: List<Attendance>)
|
||||
|
||||
@Query("SELECT * FROM Attendance WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
|
||||
fun getExams(diaryId: String, studentId: String, from: LocalDate, end: LocalDate): Maybe<List<Attendance>>
|
||||
fun getExams(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe<List<Attendance>>
|
||||
}
|
||||
|
@ -18,5 +18,5 @@ interface ExamDao {
|
||||
fun deleteAll(exams: List<Exam>)
|
||||
|
||||
@Query("SELECT * FROM Exams WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
|
||||
fun getExams(diaryId: String, studentId: String, from: LocalDate, end: LocalDate): Maybe<List<Exam>>
|
||||
fun getExams(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe<List<Exam>>
|
||||
}
|
||||
|
@ -17,5 +17,5 @@ interface GradeDao {
|
||||
fun deleteAll(grades: List<Grade>)
|
||||
|
||||
@Query("SELECT * FROM Grades WHERE semester_id = :semesterId AND student_id = :studentId")
|
||||
fun getGrades(semesterId: String, studentId: String): Maybe<List<Grade>>
|
||||
fun getGrades(semesterId: Int, studentId: Int): Maybe<List<Grade>>
|
||||
}
|
||||
|
@ -18,5 +18,5 @@ interface GradeSummaryDao {
|
||||
fun deleteAll(gradesSummary: List<GradeSummary>)
|
||||
|
||||
@Query("SELECT * FROM grades_summary WHERE student_id = :studentId AND semester_id = :semesterId")
|
||||
fun getGradesSummary(semesterId: String, studentId: String): Maybe<List<GradeSummary>>
|
||||
fun getGradesSummary(semesterId: Int, studentId: Int): Maybe<List<GradeSummary>>
|
||||
}
|
||||
|
@ -13,5 +13,5 @@ interface SemesterDao {
|
||||
fun insertAll(semester: List<Semester>)
|
||||
|
||||
@Query("SELECT * FROM Semesters WHERE student_id = :studentId")
|
||||
fun getSemester(studentId: String): Single<List<Semester>>
|
||||
fun getSemester(studentId: Int): Single<List<Semester>>
|
||||
}
|
||||
|
@ -18,5 +18,5 @@ interface TimetableDao {
|
||||
fun deleteAll(exams: List<Timetable>)
|
||||
|
||||
@Query("SELECT * FROM Timetable WHERE diary_id = :diaryId AND student_id = :studentId AND date >= :from AND date <= :end")
|
||||
fun getTimetable(diaryId: String, studentId: String, from: LocalDate, end: LocalDate): Maybe<List<Timetable>>
|
||||
fun getTimetable(diaryId: Int, studentId: Int, from: LocalDate, end: LocalDate): Maybe<List<Timetable>>
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ import java.io.Serializable
|
||||
data class Attendance(
|
||||
|
||||
@ColumnInfo(name = "student_id")
|
||||
var studentId: String,
|
||||
var studentId: Int,
|
||||
|
||||
@ColumnInfo(name = "diary_id")
|
||||
var diaryId: String,
|
||||
var diaryId: Int,
|
||||
|
||||
var date: LocalDate,
|
||||
|
||||
|
@ -10,10 +10,10 @@ import java.io.Serializable
|
||||
data class Exam(
|
||||
|
||||
@ColumnInfo(name = "student_id")
|
||||
var studentId: String,
|
||||
var studentId: Int,
|
||||
|
||||
@ColumnInfo(name = "diary_id")
|
||||
var diaryId: String,
|
||||
var diaryId: Int,
|
||||
|
||||
var date: LocalDate,
|
||||
|
||||
|
@ -10,10 +10,10 @@ import java.io.Serializable
|
||||
data class Grade(
|
||||
|
||||
@ColumnInfo(name = "semester_id")
|
||||
var semesterId: String,
|
||||
var semesterId: Int,
|
||||
|
||||
@ColumnInfo(name = "student_id")
|
||||
var studentId: String,
|
||||
var studentId: Int,
|
||||
|
||||
var subject: String,
|
||||
|
||||
|
@ -8,10 +8,10 @@ import android.arch.persistence.room.PrimaryKey
|
||||
data class GradeSummary(
|
||||
|
||||
@ColumnInfo(name = "semester_id")
|
||||
var semesterId: String,
|
||||
var semesterId: Int,
|
||||
|
||||
@ColumnInfo(name = "student_id")
|
||||
var studentId: String,
|
||||
var studentId: Int,
|
||||
|
||||
var subject: String,
|
||||
|
||||
|
@ -11,16 +11,16 @@ data class Semester(
|
||||
var id: Long = 0,
|
||||
|
||||
@ColumnInfo(name = "student_id")
|
||||
var studentId: String,
|
||||
var studentId: Int,
|
||||
|
||||
@ColumnInfo(name = "diary_id")
|
||||
var diaryId: String,
|
||||
var diaryId: Int,
|
||||
|
||||
@ColumnInfo(name = "diary_name")
|
||||
var diaryName: String,
|
||||
|
||||
@ColumnInfo(name = "semester_id")
|
||||
var semesterId: String,
|
||||
var semesterId: Int,
|
||||
|
||||
@ColumnInfo(name = "semester_name")
|
||||
var semesterName: Int,
|
||||
|
@ -21,13 +21,13 @@ data class Student(
|
||||
var symbol: String = "",
|
||||
|
||||
@ColumnInfo(name = "student_id")
|
||||
var studentId: String = "",
|
||||
var studentId: Int = 0,
|
||||
|
||||
@ColumnInfo(name = "student_name")
|
||||
var studentName: String = "",
|
||||
|
||||
@ColumnInfo(name = "school_id")
|
||||
var schoolId: String = "",
|
||||
var schoolSymbol: String = "",
|
||||
|
||||
@ColumnInfo(name = "school_name")
|
||||
var schoolName: String = ""
|
||||
|
@ -11,10 +11,10 @@ import java.io.Serializable
|
||||
data class Timetable(
|
||||
|
||||
@ColumnInfo(name = "student_id")
|
||||
var studentId: String,
|
||||
var studentId: Int,
|
||||
|
||||
@ColumnInfo(name = "diary_id")
|
||||
var diaryId: String,
|
||||
var diaryId: Int,
|
||||
|
||||
val number: Int = 0,
|
||||
|
||||
|
@ -17,7 +17,7 @@ class GradeRemote @Inject constructor(private val api: Api) {
|
||||
diaryId = semester.diaryId
|
||||
notifyDataChanged()
|
||||
}
|
||||
}).flatMap { api.getGrades(semester.semesterId.toInt()) }
|
||||
}).flatMap { api.getGrades(semester.semesterId) }
|
||||
.map { grades ->
|
||||
grades.map {
|
||||
Grade(
|
||||
|
@ -16,7 +16,7 @@ class GradeSummaryRemote @Inject constructor(private val api: Api) {
|
||||
diaryId = semester.diaryId
|
||||
notifyDataChanged()
|
||||
}
|
||||
}).flatMap { api.getGradesSummary(semester.semesterId.toInt()) }
|
||||
}).flatMap { api.getGradesSummary(semester.semesterId) }
|
||||
.map { gradesSummary ->
|
||||
gradesSummary.map {
|
||||
GradeSummary(
|
||||
|
@ -22,7 +22,7 @@ class SessionRemote @Inject constructor(private val api: Api) {
|
||||
symbol = it.symbol,
|
||||
studentId = it.studentId,
|
||||
studentName = it.studentName,
|
||||
schoolId = it.schoolId,
|
||||
schoolSymbol = it.schoolSymbol,
|
||||
schoolName = it.schoolName,
|
||||
endpoint = endpoint,
|
||||
loginType = it.loginType.name
|
||||
@ -40,7 +40,7 @@ class SessionRemote @Inject constructor(private val api: Api) {
|
||||
studentId = student.studentId,
|
||||
diaryId = it.diaryId,
|
||||
diaryName = it.diaryName,
|
||||
semesterId = it.semesterId.toString(),
|
||||
semesterId = it.semesterId,
|
||||
semesterName = it.semesterNumber,
|
||||
current = it.current
|
||||
)
|
||||
@ -51,14 +51,14 @@ class SessionRemote @Inject constructor(private val api: Api) {
|
||||
}
|
||||
|
||||
fun initApi(student: Student, checkInit: Boolean = false) {
|
||||
if (if (checkInit) api.studentId.isEmpty() else true) {
|
||||
if (if (checkInit) 0 == api.studentId else true) {
|
||||
api.run {
|
||||
email = student.email
|
||||
password = student.password
|
||||
symbol = student.symbol
|
||||
host = URL(student.endpoint).run { host + ":$port".removeSuffix(":-1") }
|
||||
ssl = student.endpoint.startsWith("https")
|
||||
schoolId = student.schoolId
|
||||
schoolSymbol = student.schoolSymbol
|
||||
studentId = student.studentId
|
||||
loginType = Api.LoginType.valueOf(student.loginType)
|
||||
notifyDataChanged()
|
||||
|
@ -99,11 +99,11 @@ class GradeFragment : BaseFragment(), GradeView, MainView.MenuFragmentView {
|
||||
presenter.onChildViewRefresh()
|
||||
}
|
||||
|
||||
fun onChildFragmentLoaded(semesterId: String) {
|
||||
fun onChildFragmentLoaded(semesterId: Int) {
|
||||
presenter.onChildViewLoaded(semesterId)
|
||||
}
|
||||
|
||||
override fun notifyChildLoadData(index: Int, semesterId: String, forceRefresh: Boolean) {
|
||||
override fun notifyChildLoadData(index: Int, semesterId: Int, forceRefresh: Boolean) {
|
||||
(childFragmentManager.fragments[index] as GradeView.GradeChildView).onParentLoadData(semesterId, forceRefresh)
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class GradePresenter @Inject constructor(
|
||||
|
||||
private var semesters = emptyList<Semester>()
|
||||
|
||||
private val loadedSemesterId = mutableMapOf<Int, String>()
|
||||
private val loadedSemesterId = mutableMapOf<Int, Int>()
|
||||
|
||||
fun onAttachView(view: GradeView, savedIndex: Int?) {
|
||||
super.onAttachView(view)
|
||||
@ -55,7 +55,7 @@ class GradePresenter @Inject constructor(
|
||||
view?.let { loadChild(it.currentPageIndex(), forceRefresh = true) }
|
||||
}
|
||||
|
||||
fun onChildViewLoaded(semesterId: String) {
|
||||
fun onChildViewLoaded(semesterId: Int) {
|
||||
view?.apply {
|
||||
showContent(true)
|
||||
showProgress(false)
|
||||
|
@ -14,7 +14,7 @@ interface GradeView : BaseView {
|
||||
|
||||
fun showSemesterDialog(selectedIndex: Int)
|
||||
|
||||
fun notifyChildLoadData(index: Int, semesterId: String, forceRefresh: Boolean)
|
||||
fun notifyChildLoadData(index: Int, semesterId: Int, forceRefresh: Boolean)
|
||||
|
||||
fun notifyChildParentReselected(index: Int)
|
||||
|
||||
@ -24,7 +24,7 @@ interface GradeView : BaseView {
|
||||
|
||||
fun onParentChangeSemester()
|
||||
|
||||
fun onParentLoadData(semesterId: String, forceRefresh: Boolean)
|
||||
fun onParentLoadData(semesterId: Int, forceRefresh: Boolean)
|
||||
|
||||
fun onParentReselected()
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class GradeDetailsFragment : BaseFragment(), GradeDetailsView, GradeView.GradeCh
|
||||
GradeDetailsDialog.newInstance(grade).show(fragmentManager, grade.toString())
|
||||
}
|
||||
|
||||
override fun onParentLoadData(semesterId: String, forceRefresh: Boolean) {
|
||||
override fun onParentLoadData(semesterId: Int, forceRefresh: Boolean) {
|
||||
presenter.onParentViewLoadData(semesterId, forceRefresh)
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ class GradeDetailsFragment : BaseFragment(), GradeDetailsView, GradeView.GradeCh
|
||||
presenter.onParentViewChangeSemester()
|
||||
}
|
||||
|
||||
override fun notifyParentDataLoaded(semesterId: String) {
|
||||
override fun notifyParentDataLoaded(semesterId: Int) {
|
||||
(parentFragment as? GradeFragment)?.onChildFragmentLoaded(semesterId)
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ class GradeDetailsPresenter @Inject constructor(
|
||||
view.initView()
|
||||
}
|
||||
|
||||
fun onParentViewLoadData(semesterId: String, forceRefresh: Boolean) {
|
||||
fun onParentViewLoadData(semesterId: Int, forceRefresh: Boolean) {
|
||||
disposable.add(sessionRepository.getSemesters()
|
||||
.flatMap { gradeRepository.getGrades(it.first { item -> item.semesterId == semesterId }, forceRefresh) }
|
||||
.map { createGradeItems(it.groupBy { grade -> grade.subject }.toSortedMap()) }
|
||||
|
@ -40,7 +40,7 @@ interface GradeDetailsView : BaseView {
|
||||
|
||||
fun weightString(): String
|
||||
|
||||
fun notifyParentDataLoaded(semesterId: String)
|
||||
fun notifyParentDataLoaded(semesterId: Int)
|
||||
|
||||
fun notifyParentRefresh()
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class GradeSummaryFragment : BaseFragment(), GradeSummaryView, GradeView.GradeCh
|
||||
gradeSummarySwipe.isRefreshing = show
|
||||
}
|
||||
|
||||
override fun onParentLoadData(semesterId: String, forceRefresh: Boolean) {
|
||||
override fun onParentLoadData(semesterId: Int, forceRefresh: Boolean) {
|
||||
presenter.onParentViewLoadData(semesterId, forceRefresh)
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ class GradeSummaryFragment : BaseFragment(), GradeSummaryView, GradeView.GradeCh
|
||||
presenter.onParentViewChangeSemester()
|
||||
}
|
||||
|
||||
override fun notifyParentDataLoaded(semesterId: String) {
|
||||
override fun notifyParentDataLoaded(semesterId: Int) {
|
||||
(parentFragment as? GradeFragment)?.onChildFragmentLoaded(semesterId)
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ class GradeSummaryPresenter @Inject constructor(
|
||||
view.initView()
|
||||
}
|
||||
|
||||
fun onParentViewLoadData(semesterId: String, forceRefresh: Boolean) {
|
||||
fun onParentViewLoadData(semesterId: Int, forceRefresh: Boolean) {
|
||||
disposable.add(sessionRepository.getSemesters()
|
||||
.map { semester -> semester.first { it.semesterId == semesterId } }
|
||||
.flatMap {
|
||||
|
@ -26,7 +26,7 @@ interface GradeSummaryView : BaseView {
|
||||
|
||||
fun finalString(): String
|
||||
|
||||
fun notifyParentDataLoaded(semesterId: String)
|
||||
fun notifyParentDataLoaded(semesterId: Int)
|
||||
|
||||
fun notifyParentRefresh()
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ class AttendanceRemoteTest {
|
||||
getAttendance("2018-09-17")
|
||||
))
|
||||
|
||||
every { mockApi.diaryId } returns "1"
|
||||
every { semesterMock.studentId } returns "1"
|
||||
every { semesterMock.diaryId } returns "1"
|
||||
every { mockApi.diaryId } returns 1
|
||||
every { semesterMock.studentId } returns 1
|
||||
every { semesterMock.diaryId } returns 1
|
||||
|
||||
val attendance = AttendanceRemote(mockApi).getAttendance(semesterMock,
|
||||
LocalDate.of(2018, 9, 10),
|
||||
|
@ -36,9 +36,9 @@ class ExamRemoteTest {
|
||||
getExam("2018-09-17")
|
||||
))
|
||||
|
||||
every { mockApi.diaryId } returns "1"
|
||||
every { semesterMock.studentId } returns "1"
|
||||
every { semesterMock.diaryId } returns "1"
|
||||
every { mockApi.diaryId } returns 1
|
||||
every { semesterMock.studentId } returns 1
|
||||
every { semesterMock.diaryId } returns 1
|
||||
|
||||
val exams = ExamRemote(mockApi).getExams(semesterMock,
|
||||
LocalDate.of(2018, 9, 10),
|
||||
|
@ -22,7 +22,7 @@ class SessionRemoteTest {
|
||||
|
||||
@Test
|
||||
fun testRemoteAll() {
|
||||
doReturn(Single.just(listOf(Pupil("", "", "", "test", "", "", Api.LoginType.AUTO))))
|
||||
doReturn(Single.just(listOf(Pupil("", "", 1, "test", "", "", Api.LoginType.AUTO))))
|
||||
.`when`(mockApi).getPupils()
|
||||
|
||||
val students = SessionRemote(mockApi).getConnectedStudents("", "", "", "http://fakelog.cf").blockingGet()
|
||||
|
@ -36,9 +36,9 @@ class TimetableRemoteTest {
|
||||
getTimetable("2018-09-17")
|
||||
))
|
||||
|
||||
every { mockApi.diaryId } returns "1"
|
||||
every { semesterMock.studentId } returns "1"
|
||||
every { semesterMock.diaryId } returns "1"
|
||||
every { mockApi.diaryId } returns 1
|
||||
every { semesterMock.studentId } returns 1
|
||||
every { semesterMock.diaryId } returns 1
|
||||
|
||||
val timetable = TimetableRemote(mockApi).getTimetable(semesterMock,
|
||||
LocalDate.of(2018, 9, 10),
|
||||
|
@ -13,19 +13,19 @@ class GradeExtensionTest {
|
||||
fun calcWeightedAverage() {
|
||||
val localDate = mock(LocalDate::class.java)
|
||||
assertEquals(3.47, listOf(
|
||||
Grade("", "", "", "", 5, 0.33
|
||||
Grade(1, 1, "", "", 5, 0.33
|
||||
, "", "", "", "", "",
|
||||
6, localDate, ""),
|
||||
Grade("", "", "", "", 5, -0.33
|
||||
Grade(1, 1, "", "", 5, -0.33
|
||||
, "", "", "", "", "",
|
||||
5, localDate, ""),
|
||||
Grade("", "", "", "", 4, 0.0
|
||||
Grade(1, 1, "", "", 4, 0.0
|
||||
, "", "", "", "", "",
|
||||
1, localDate, ""),
|
||||
Grade("", "", "", "", 1, 0.5
|
||||
Grade(1, 1, "", "", 1, 0.5
|
||||
, "", "", "", "", "",
|
||||
9, localDate, ""),
|
||||
Grade("", "", "", "", 0, 0.0
|
||||
Grade(1, 1, "", "", 0, 0.0
|
||||
, "", "", "", "", "",
|
||||
0, localDate, "")
|
||||
).calcAverage(), 0.005)
|
||||
@ -34,10 +34,10 @@ class GradeExtensionTest {
|
||||
@Test
|
||||
fun calcSummaryAverage() {
|
||||
assertEquals(2.5, listOf(
|
||||
GradeSummary("", "", "", "", "5"),
|
||||
GradeSummary("", "", "", "", "-5"),
|
||||
GradeSummary("", "", "", "", "test"),
|
||||
GradeSummary("", "", "", "", "0")
|
||||
GradeSummary(1, 1, "", "", "5"),
|
||||
GradeSummary(1, 1, "", "", "-5"),
|
||||
GradeSummary(1, 1, "", "", "test"),
|
||||
GradeSummary(1, 1, "", "", "0")
|
||||
).calcAverage(), 0.005)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user