-
Notifications
You must be signed in to change notification settings - Fork 34
add_daily_stats #617
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
add_daily_stats #617
Conversation
dbcab17
to
95b68b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I've added many comments but they're mostly minor improvements. Overall it looks good!
Could you also rebase your changes against the latest master?
<a th:href="@{${SITE_EVENTS_PAGE}}" th:text="#{t_watch_suspicious_activities}" href="events.html">view suspicious activities</a> | ||
</li> | ||
<li sec:authorize="hasAuthority('VIEW_DAILY_STATS')"> | ||
<a th:href="@{${DAILY_STATISTICS}}" th:text="#{t_daily_statistics}" href="../report/daily">view daily statistics</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we don't have report/daily
page then let's use href="javascript:void(0)"
here.
); | ||
report.setMissingCsrfCounter(missingCsrfCounter); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove these whitespace-only changes?
private final MailService mailService; | ||
private final CronService cronService; | ||
|
||
@RequestMapping(Url.DAILY_STATISTICS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RequestMapping
-> @GetMapping
public ReportController getReportController() { | ||
return new ReportController( | ||
servicesConfig.getMailService(), | ||
servicesConfig.getCronService() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce indentation for this line, please.
public static final String INDEX_PAGE = "/"; | ||
public static final String ROBOTS_TXT = "/robots.txt"; | ||
public static final String SITEMAP_XML = "/sitemap.xml"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid white-space only changes where it's possible.
); | ||
printWriter.println(stats); | ||
} catch (IOException e) { | ||
LOG.error("Can't get Daily Reports", e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Daily Reports/daily report/
private final CronService cronService; | ||
|
||
@RequestMapping(Url.DAILY_STATISTICS) | ||
public void adminDailyReport(HttpServletResponse response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/adminDailyReport/showDailyReport/
response.setCharacterEncoding("UTF-8"); | ||
|
||
try { | ||
PrintWriter printWriter = response.getWriter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/printWriter/writer/
cronService.getDailyStatistics() | ||
); | ||
printWriter.println(stats); | ||
} catch (IOException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/e/ex/
private final MailService mailService; | ||
private final CronService cronService; | ||
|
||
@RequestMapping(Url.DAILY_STATISTICS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you test for me the following (inspired by https://stackoverflow.com/a/7672903/352708):
- add
consumes
parameter to@GetMapping
(see https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html#produces--) - add
@ResponseBody
annotation - return
String
from the controller
Does it work the same as the current approach?
…d: port to Robot Framework. Addressed to php-coder#530 No functional changes.
…d: port to Robot Framework. Addressed to php-coder#530 No functional changes.
I don't want to port it to Robot Framework because a) it will be hard b) now I don't think that this check was so useful
Addressed to php-coder#530 No functional changes.
Should be in 7cfaf2d commit. No functional changes.
Should be in 29c8230 commit. No functional changes.
Addressed to php-coder#530 No functional changes.
Addressed to php-coder#530 No functional changes.
Addressed to php-coder#530 No functional changes.
…ory with name that differs only by case. Fix php-coder#446
…ry with name that differs only by case. Fix php-coder#447
No code changes.
No functional changes.
No functional changes.
Addressed to php-coder#530 No functional changes.
Addressed to php-coder#530 No functional changes.
Addressed to php-coder#530 No functional changes.
Addressed to php-coder#530 No functional changes.
Addressed to php-coder#530 No functional changes.
…igation is used. No functional changes.
Addressed to php-coder#530 No functional changes.
…ework. Addressed to php-coder#530 No functional changes.
Changelog: https://projectlombok.org/changelog.html No functional changes.
Changelogs: - http://forum.thymeleaf.org/Thymeleaf-3-0-3-and-Spring-5-integration-JUST-PUBLISHED-td4030168.html - https://github.com/thymeleaf/thymeleaf/blob/thymeleaf-3.0.3.RELEASE/ChangeLog.txt - https://github.com/thymeleaf/thymeleaf-spring/blob/thymeleaf-spring4-3.0.3.RELEASE/thymeleaf-spring4/ChangeLog.txt No functional changes.
Prior this change it was failing with the following error: /home/travis/.travis/job_stages: line 567: expected `)' /home/travis/.travis/job_stages: line 567: syntax error near `-a' /home/travis/.travis/job_stages: line 567: ` if [[ ($TRAVIS_BRANCH = prod) && ("$SPRING_PROFILES_ACTIVE" = "travis" -a "$TRAVIS_PULL_REQUEST" = "false") ]]; then' Correction for d5289a4 commit.
I don't want to port it to the Robot Framework because I'm trying to make tests to test a behavior instead of the pages state. No functional changes.
No functional changes.
This reverts commit 08bb9a4. Reverting this change won't harm but it's possible that it solves "Cannot find a merge base between danger_base and danger_head" error from Danger.
This reverts commit ad3a23e.
…e between danger_base and danger_head" error." This reverts commit f0db775.
…t modified. Now the checks will be run only when the files with the following patterns were modified: - sortpom: pom.xml - enforcer: pom.xml - checkstyle: pom.xml, *.java, *.properties, checkstyle.xml, checkstyle-suppressions.xml - findbugs: pom.xml, *.java, findbugs-filter.xml - pmd: pom.xml, *.java, pmd.xml - unit tests: pom.xml, *.java, *.groovy - license: pom.xml, *.java, *.groovy, license_header.txt - codenarc: pom.xml, *.groovy - jasmine: pom.xml, *.js - rflint: .travis.yml, *.robot - bootlint: .travis.yml *.html - html5validator: .travis.yml *.html Integration tests are executed always. Fix php-coder#423
No functional changes.
Changelog: https://projectlombok.org/changelog No functional changes.
Changelog: https://projectlombok.org/changelog No functional changes.
No functional changes.
…upport.beanvalidation Addressed to php-coder#591 No functional changes.
Should be in ba82718 commit. No code changes.
Should be in ba82718 commit. No code changes.
This also updates Spring Framework to 4.3.9.RELEASE Changelog: - https://spring.io/blog/2017/06/08/spring-boot-1-4-7-available-now - https://spring.io/blog/2017/06/07/spring-framework-4-3-9-available-now No functional changes.
@bodom91 Looks like you tried to use rebase but did it wrong. Typically it should be about 3 steps to refresh a working branch:
|
* @author Maxim Shestakov | ||
*/ | ||
@Controller | ||
@RestController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use @Controller
.
} catch (IOException ex) { | ||
LOG.error("Can't get daily report", ex.getMessage()); | ||
} | ||
@GetMapping(value = Url.DAILY_STATISTICS, produces = {"text/plain; charset=UTF-8"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-@GetMapping(value = Url.DAILY_STATISTICS, produces = {"text/plain; charset=UTF-8"})
+@GetMapping(path = Url.DAILY_STATISTICS, produces = "text/plain; charset=UTF-8")
} | ||
|
||
private String getTextOfDailyStatisticsMail(AdminDailyReport report) { | ||
public String getTextOfDailyStatisticsMail(AdminDailyReport report) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add @Override
annotation to this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this method should be placed before private methods.
LOG.error("Can't get daily report", ex.getMessage()); | ||
} | ||
@GetMapping(value = Url.DAILY_STATISTICS, produces = {"text/plain; charset=UTF-8"}) | ||
@ResponseBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for your information: @RestController
is essentially the same as @Controller
and @ResponseBody
. Having both is superfluous.
I did it |
Generated by 🚫 Danger |
But why? You can just push with |
I see that your master is OK. And I can't see what was in the |
Superseded by #618 |
Sorry for my delay.