Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correction #21

Merged
merged 2 commits into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/main/java/org/scada_lts/dao/CountInDayDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ private String prepareSQL() {
int year = Configuration.getInstance().getConf().getYear();
int month = Configuration.getInstance().getConf().getMonth();

return "SELECT * FROM visitors_by_day_view WHERE \"Date\" ~ '^"
System.out.println(year);
System.out.println(month);

/*return "SELECT * FROM visitors_by_day_view WHERE \"Date\" ~ '^"
+ formatPartOfDate(year) + "."
+ formatPartOfDate(month) + "'";
+ formatPartOfDate(month) + "'";*/
String sql = "SELECT * FROM visitors_by_day_view WHERE \"Date\" like '%."
+ formatPartOfDate(month) + "."
+ formatPartOfDate(year) + "'";

System.out.println(sql);

return sql;
}

private CountInDay[] extractCountInDayFromResultSet(ResultSet rs) throws SQLException {
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/scada_lts/dao/CountInMonthDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ private String prepareSQL() {
int year = Configuration.getInstance().getConf().getYear();
int month = Configuration.getInstance().getConf().getMonth();

return "SELECT * FROM visitors_by_month_view WHERE \"date\" ~ '^"
+ formatPartOfDate(year) + "'";
String sql = "SELECT * FROM visitors_by_month_view WHERE \"date\" like '"
+ formatPartOfDate(year) + ".%'";

System.out.println(sql);

return sql;
}

private CountInMonth[] extractCountInMonthFromResultSet(ResultSet rs) throws SQLException {
Expand Down