Skip to content

Commit 156167a

Browse files
committed
1.7.3
1 parent 9b93008 commit 156167a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/src/main/java/com/aerophile/app/DemarrageActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,9 @@ void demarrerJournee() {
418418

419419
if(changement) {
420420

421+
// Si il y a changement, alors la journee courante n'est plus en cours
422+
daoJournee.aucuneJourneeEnCours();
423+
421424
nouvelleJournee.setEnCours(1);
422425
nouvelleJournee.setDate(dateSelectionnee.getTime());
423426
nouvelleJournee.setTemperature(Integer.valueOf(temperatureJournee));
@@ -435,8 +438,6 @@ void demarrerJournee() {
435438

436439
if(enCours) {
437440

438-
// Si il y a changement, alors la journee courante n'est plus en cours
439-
journeeCourante.setEnCours(0);
440441
// On enregistre
441442
daoJournee.modifierJournee(journeeCourante);
442443

app/src/main/java/com/aerophile/app/dao/JourneeDAO.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ public boolean modifierJournee(Journee journee) {
135135
return true;
136136
}
137137

138+
public boolean aucuneJourneeEnCours() {
139+
ContentValues values = new ContentValues();
140+
values.put(DatabaseHandler.JOURNEE_ENCOURS, 0);
141+
database.update(DatabaseHandler.JOURNEE_TABLE_NAME, values, null, null);
142+
return true;
143+
}
144+
138145
public Journee getDerniereJournee(){
139146
Cursor cursor = database.query(DatabaseHandler.JOURNEE_TABLE_NAME, allColumns, null, null, null, null, DatabaseHandler.JOURNEE_KEY + " DESC");
140147
cursor.moveToFirst();

0 commit comments

Comments
 (0)