#70 fast fix
This commit is contained in:
parent
9edcf35338
commit
0e062f1337
@ -8,6 +8,6 @@ import ru.ulstu.ping.model.Ping;
|
||||
|
||||
public interface PingRepository extends JpaRepository<Ping, Integer> {
|
||||
|
||||
@Query("SELECT count(*) FROM Ping p WHERE (DAY(p.date) = :day) AND (MONTH(p.date) = :month) AND (p.conference = :conference)")
|
||||
long countByConferenceAndDate(@Param("conference") Conference conference, @Param("day") Integer day, @Param("month") Integer month);
|
||||
@Query("SELECT count(*) FROM Ping p WHERE (DAY(p.date) = :day) AND (MONTH(p.date) = :month) AND (YEAR(p.date) = :year) AND (p.conference = :conference)")
|
||||
long countByConferenceAndDate(@Param("conference") Conference conference, @Param("day") Integer day, @Param("month") Integer month, @Param("year") Integer year);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class PingService {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(yesterday);
|
||||
|
||||
return Math.toIntExact(pingRepository.countByConferenceAndDate(conference, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1));
|
||||
return Math.toIntExact(pingRepository.countByConferenceAndDate(conference, cal.get(Calendar.DAY_OF_MONTH),
|
||||
cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR)));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user