Terminado backend de gestionde varios meses con varias gestiones
This commit is contained in:
@@ -11,6 +11,25 @@ private ArrayList<Mes> meses;
|
||||
this.meses = new ArrayList<Mes>();
|
||||
}
|
||||
|
||||
public void aniadirGestion(String nombre, int anio, Month mes) {
|
||||
try {
|
||||
for(Mes mesSelect:this.meses) {
|
||||
if(mesSelect.getMes().equals(mes) && mesSelect.getAnio() == anio){
|
||||
mesSelect.getGestiones().add(new Gestion(nombre));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}catch (NullPointerException e) {
|
||||
ArrayList<Gestion> gestiones=new ArrayList<Gestion>();
|
||||
gestiones.add(new Gestion(nombre));
|
||||
this.meses.add(new Mes(gestiones,anio,mes));
|
||||
return;
|
||||
}
|
||||
ArrayList<Gestion> gestiones=new ArrayList<Gestion>();
|
||||
gestiones.add(new Gestion(nombre));
|
||||
this.meses.add(new Mes(gestiones,anio,mes));
|
||||
}
|
||||
|
||||
public void aniadirTransaccion(Transaccion transaccion, String nombre) {
|
||||
for(Mes mes:this.meses) {
|
||||
if(transaccion.getDia().getMonth().equals(mes.getMes()) &&
|
||||
@@ -19,7 +38,8 @@ private ArrayList<Mes> meses;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.meses.add(new Mes(new ArrayList<Gestion>()));
|
||||
this.meses.add(new Mes(new ArrayList<Gestion>(),transaccion.getDia().getYear(),
|
||||
transaccion.getDia().getMonth()));
|
||||
this.meses.get(this.meses.size()-1).aniadirTransaccion(transaccion, nombre);
|
||||
}
|
||||
|
||||
@@ -42,8 +62,10 @@ class Mes{
|
||||
private Month mes;
|
||||
int total;
|
||||
ArrayList<Gestion> gestiones;
|
||||
Mes(ArrayList<Gestion> gestiones){
|
||||
Mes(ArrayList<Gestion> gestiones, int anio, Month mes){
|
||||
this.gestiones = gestiones;
|
||||
this.anio=anio;
|
||||
this.mes=mes;
|
||||
}
|
||||
|
||||
void aniadirTransaccion(Transaccion transaccion, String nombre) {
|
||||
|
||||
Reference in New Issue
Block a user