the current syntax doesn't work properly in Rails 5, the resulting query
looks like:
HAVING "events"."project_id" IN (0)
instead of:
HAVING "events"."project_id" IN (SELECT "projects"."id" FROM...
Also we should not use ActiveRecord internal methods. In this case we
can filter projects in WHERE clause instead of doing this in HAVING
clause. Usage of WHERE should be also more efficient because grouping
is then done on much smaller subset of records.
Respect project visibility settings in the contributions calendar
This MR fixes a number of bugs relating to access controls and date selection of events for the contributions calendar
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23403
See merge request !2019
Signed-off-by: Rémy Coutable <remy@rymai.me>
When using MySQL as database backend in GitLab, ``date`` in ``date(created_at), count(id) as total_amount``
won't return the ``date`` column (should be ``date(created_at)``), as a result, there's no contribution in the user
profile page.
Adding an ``as date`` can solve this problem.
* count opening of issues and merge requests
* dont trigger git repository - use events from database
* much-much faster since does not affected by repository size