Fixes background issues

hh
Laurent 6 years ago
parent 17bbb7765e
commit 95f414f6d5
  1. 16
      app/src/main/java/net/pokeranalytics/android/model/realm/handhistory/HandHistory.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt
  3. 8
      app/src/test/java/net/pokeranalytics/android/BasicUnitTest.kt

@ -421,18 +421,6 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable,
} }
} }
// private fun definesIfHeroWins() {
// this.heroIndex?.let { heroIndex ->
//
// val heroCards = this.playerSetupForPosition(heroIndex)?.cards
// val heroNumberOfCards = heroCards?.size ?: 0
// if (this.board.size == 5 && heroNumberOfCards > 1) {
//
// }
//
// }
// }
/*** /***
* Creates a list of cards for the hand history to give a representation of the hand * Creates a list of cards for the hand history to give a representation of the hand
* We will try to add a minimum of 5 cards using by priority: * We will try to add a minimum of 5 cards using by priority:
@ -462,7 +450,7 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable,
cardSets.add(this.board) cardSets.add(this.board)
// Try to add cards but not too much // Try to add cards but not too much
while (views.size < 6 && cardSets.isNotEmpty()) { while (views.size < 5 && cardSets.isNotEmpty()) {
val cardSet = cardSets.removeAt(0) val cardSet = cardSets.removeAt(0)
@ -485,7 +473,7 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable,
return views return views
} }
fun compareHands(activePositions: List<Int>): List<Int> { private fun compareHands(activePositions: List<Int>): List<Int> {
// Evaluate all hands // Evaluate all hands
val results = activePositions.map { val results = activePositions.map {

@ -819,7 +819,7 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra
return if (this.isEdited) { return if (this.isEdited) {
if (position < this.settingsRowCount) R.color.green_header else R.color.transparent if (position < this.settingsRowCount) R.color.green_header else R.color.transparent
} else { } else {
null R.color.transparent
} }
} }

@ -15,9 +15,11 @@ class BasicUnitTest : RealmUnitTest() {
@Test @Test
fun testStandardFormatting() { fun testStandardFormatting() {
val n = 2222.0
val f = n.formatted val s = "2222"
Assert.assertEquals("2 222", f) val p = s.toDouble()
Assert.assertEquals(2222.0, p, 0.001)
} }
@Test @Test

Loading…
Cancel
Save