Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int getDailyWins() {
- int dailyGamesWon = 0;
- Date currentDate = new Date();
- Calendar calenderStart = Calendar.getInstance();
- calenderStart.setTime(currentDate);
- if (calenderStart.get(Calendar.HOUR_OF_DAY) < DAILY_RESET_TIME)
- calenderStart.set(Calendar.DAY_OF_MONTH, -1);
- calenderStart.set(Calendar.HOUR_OF_DAY, DAILY_RESET_TIME);
- for (Game g : games) {
- Calendar calendarGame = Calendar.getInstance();
- calendarGame.setTime(g.getDate());
- if(calendarGame.after(calenderStart))
- if(g.getWon())
- dailyGamesWon++;
- }
- return dailyGamesWon;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement