correction on mise calculation
This commit is contained in:
@@ -159,7 +159,7 @@ public class BetValidation extends Fragment {
|
||||
|
||||
private void setupNumberGrid(GridLayout grid) {
|
||||
binding.gridNumbers.removeAllViews();
|
||||
int columns = 7;
|
||||
int columns = 8;
|
||||
grid.setColumnCount(columns);
|
||||
if(shared.selectedCourse.getValue() != null){
|
||||
for (int i = 1; i <= shared.selectedCourse.getValue().getPartants(); i++) {
|
||||
@@ -238,6 +238,7 @@ public class BetValidation extends Fragment {
|
||||
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
||||
if(activity != null){
|
||||
MaterialToolbar toolbar = activity.findViewById(R.id.toolbar);
|
||||
toolbar.setBackgroundColor( getResources().getColor(R.color.primary_green));
|
||||
activity.setSupportActionBar(toolbar);
|
||||
if(activity.getSupportActionBar() != null){
|
||||
activity.getSupportActionBar().setTitle("Pari "+shared.selectedCourse.getValue().getNom());
|
||||
@@ -268,16 +269,30 @@ public class BetValidation extends Fragment {
|
||||
@Override
|
||||
public void onChanged(List<String> horses) {
|
||||
calculateMise(horses);
|
||||
if(horses.size() > shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
binding.elargie.setVisibility(View.GONE);
|
||||
}
|
||||
if(shared.typeOfBet.getValue().getNumberOfHorse() > 2 && horses.size() >= shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.order.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
binding.order.setVisibility(View.GONE);
|
||||
}
|
||||
if(horses.contains("X")){
|
||||
if(selectedHorses.getValue().size() == shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
binding.elargie.setText("Champ total");
|
||||
return;
|
||||
}else{
|
||||
if(selectedHorses.getValue().size() > shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
binding.elargie.setText("Champ partiel");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(horses.size() > shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
binding.elargie.setText("Elargi");
|
||||
}else{
|
||||
binding.elargie.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
binding.order.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
@@ -302,6 +317,10 @@ public class BetValidation extends Fragment {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.mise == 0){
|
||||
Toast.makeText(getContext(), "Pari non valide", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Pari pari = new Pari(
|
||||
@@ -486,6 +505,12 @@ public class BetValidation extends Fragment {
|
||||
}
|
||||
mise = mise * coeff;
|
||||
if(nombreX>0){
|
||||
if(nombreChevauxSelectionnes - typeOfBetHorses == 1){
|
||||
mise = 0;
|
||||
this.mise = mise;
|
||||
binding.mise.setText(mise+" CFA");
|
||||
return;
|
||||
}
|
||||
if(nombreChevauxSelectionnes == typeOfBetHorses){
|
||||
mise = mise * _calculateArrangement((partants - (typeOfBetHorses-nombreX)), nombreX);
|
||||
}else{
|
||||
@@ -498,8 +523,9 @@ public class BetValidation extends Fragment {
|
||||
binding.mise.setText(mise+" CFA");
|
||||
return;
|
||||
}
|
||||
mise = mise * _calculateCombinaison(nombreChevauxSelectionnes, typeOfBetHorses);
|
||||
if(order){
|
||||
if(!order){
|
||||
mise = mise * _calculateCombinaison(nombreChevauxSelectionnes, typeOfBetHorses);
|
||||
}else{
|
||||
mise = mise * _calculateArrangement(nombreChevauxSelectionnes, typeOfBetHorses);
|
||||
}
|
||||
this.mise = mise;
|
||||
|
||||
Reference in New Issue
Block a user