Skip to content

Commit

Permalink
Convert Score and eliminate old Contest setters
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabi Scardine Silva authored and Gabi Scardine Silva committed Jun 5, 2017
1 parent 50516b5 commit 9e63baf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 55 deletions.
10 changes: 0 additions & 10 deletions app/src/main/java/io/intrepid/contest/models/Contest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ open class Contest {
description = `in`.readString()
}

fun setTitle(title: String): Builder {
this.title = title
return this
}

fun setDescription(description: String): Builder {
this.description = description
return this
}

fun build(): Contest {
if (creationDate == null) {
creationDate = Date()
Expand Down
45 changes: 0 additions & 45 deletions app/src/main/java/io/intrepid/contest/models/Score.java

This file was deleted.

28 changes: 28 additions & 0 deletions app/src/main/java/io/intrepid/contest/models/Score.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.intrepid.contest.models

import com.google.gson.annotations.SerializedName

import java.util.UUID

class Score(category: Category, score: Int) {
var scoreValue: Int = 0
internal set
@SerializedName("scoring_category_id")
private val categoryId: UUID?
@Transient val categoryName: String?
@Transient val categoryDescription: String?

init {
this.categoryId = category.id
this.categoryName = category.name
this.categoryDescription = category.description
this.scoreValue = score
}

override fun equals(other: Any?): Boolean {
if (other !is Score) {
return false
}
return scoreValue == other.scoreValue
}
}

0 comments on commit 9e63baf

Please sign in to comment.