Skip to content

Commit

Permalink
Update PrayerTimesValidation.java
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelrahmanBayoumi committed Apr 18, 2021
1 parent e86815e commit 83a0145
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ public static boolean checkForSpareData() {
if (daysBetween <= 5) {
// fetch new Month data from API
ArrayList<PrayerTimes> prayerTimesMonth = WebService.getPrayerTimesMonth(lastDateStored.plusDays(1));
if (prayerTimesMonth.size() < 1) {
return false;
}
// check if there is any days of fetched month in DB => delete it to insert the new data of the same month
System.out.println("prayerTimesMonth.size:" + prayerTimesMonth.size());
if (prayerTimesMonth.get(0).getLocalDate().getMonth().getValue() == lastDateStored.getMonth().getValue()) {
System.out.println("deletePrayerTimesInSpecificMonth");
PrayerTimesDBManager.deletePrayerTimesInSpecificMonth(lastDateStored);
}
// insert prayerTimes to DB
System.out.println("prayerTimesMonth.size:" + prayerTimesMonth.size());
if (prayerTimesMonth.size() < 1 || !PrayerTimesDBManager.insertPrayerTimesData(prayerTimesMonth)) {
if (!PrayerTimesDBManager.insertPrayerTimesData(prayerTimesMonth)) {
return false;
}
}
Expand Down

0 comments on commit 83a0145

Please sign in to comment.