Only show stats with evolution values for Evolution reports

dev
Laurent 7 years ago
parent f3f6deb070
commit c6833d2911
  1. 16
      app/src/main/java/net/pokeranalytics/android/calculus/Stat.kt
  2. 10
      app/src/main/java/net/pokeranalytics/android/ui/fragment/ReportCreationFragment.kt

@ -63,6 +63,11 @@ enum class Stat : RowRepresentable {
return values().filter { it.canBeUserSelected }
}
val evolutionValuesList: List<Stat>
get() {
return values().filter { it.hasEvolutionValues }
}
fun returnOnInvestment(netResult: Double, buyin: Double): Double? {
if (buyin == 0.0) {
return null
@ -259,6 +264,17 @@ enum class Stat : RowRepresentable {
}
}
private val hasEvolutionValues: Boolean
get() {
return when (this) {
NET_RESULT, NET_BB_PER_100_HANDS, HOURLY_RATE_BB,
AVERAGE_HOURLY_DURATION, HOURLY_DURATION,
NUMBER_OF_SETS, ROI, AVERAGE_BUYIN, WIN_RATIO,
AVERAGE_NET_BB, NUMBER_OF_GAMES, AVERAGE -> true
else -> false
}
}
override val viewType: Int = RowViewType.TITLE_VALUE.ordinal
}

@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import io.realm.Realm
import kotlinx.android.synthetic.main.fragment_report_creation.*
@ -69,7 +68,7 @@ class ReportCreationFragment : RealmFragment(), RowRepresentableDataSource, RowR
private fun updateUIWithCurrentStep() {
this.next.isVisible = this.assistant.nextButtonShouldAppear
this.next.visibility = if (this.assistant.nextButtonShouldAppear) View.VISIBLE else View.GONE
this.next.text = requireContext().getString(this.assistant.nextButtonTitleResId)
this.next.isEnabled = this.assistant.nextEnabled
@ -242,7 +241,12 @@ class Assistant {
Calculator.Options.Display.EVOLUTION,
Calculator.Options.Display.COMPARISON
)
Step.STAT -> Stat.userSelectableList
Step.STAT -> {
when (this.display) {
Calculator.Options.Display.EVOLUTION -> Stat.evolutionValuesList
else -> Stat.userSelectableList
}
}
Step.COMPARATOR -> Criteria.all
Step.FILTER -> {
val realm = Realm.getDefaultInstance()

Loading…
Cancel
Save