-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Hack: history heatmap for user #4918
Comments
Could you send a PR ? |
Unfortunately not yet, because I hack the necessary API for that with python. It need to be integrated into gitea API. |
The main problem is my SQL statement (which only works for MariaDB) CREATE
PROCEDURE commithistory( USERNAME varchar(64) )
BEGIN
with list_of_dates as(
SELECT
CURRENT_DATE - INTERVAL (seq) DAY date
FROM
seq_0_to_365 ),
actions as(
select
`action`.created_unix as time_sec,
count( user_id ) as value,
DATE_FORMAT( FROM_UNIXTIME( `action`.created_unix ),
'%Y-%m-%d' ) as dates
from
`action`
inner join `user` on
( `user`.id = `action`.user_id )
where
`user`.lower_name = USERNAME
group by
DATE_FORMAT( FROM_UNIXTIME( `action`.created_unix ),
'%Y-%m-%d' )
order by
`action`.created_unix ) select
list_of_dates.`date` as `date`,
ifnull( actions.value,
0 ) as count
from
list_of_dates
left join actions on
( list_of_dates.`date` = actions.dates )
order by
list_of_dates.`date`;
END; a
The query time on my MariaDB instance is alway < 100ms :) Depending on the js heatmap implementation, |
I've tested it, and for https://github.com/WildCodeSchool/vue-calendar-heatmap the CREATE
PROCEDURE commithistory2( USERNAME varchar(64) )
BEGIN
select
count(user_id) as count,
DATE_FORMAT( FROM_UNIXTIME( `action`.created_unix ),
'%Y-%m-%d' ) as `date`
from
`action`
inner join `user` on
( `user`.id = `action`.user_id )
where
`user`.lower_name = USERNAME
group by
DATE_FORMAT( FROM_UNIXTIME( `action`.created_unix ),
'%Y-%m-%d' )
order by
`action`.created_unix;
END; So some questions are open before I start working on a pull request.
cc @lunny |
It seems the SQL is not complex. |
this one should be closed? |
duplicated with #6 |
I deploy a 2nd service (using python hug) to serve a user heatmap (using https://github.com/WildCodeSchool/vue-calendar-heatmap). Finally I just included it in the
templates/user/profile.tmpl
origin: https://git.osuv.de/m/gitea-user-heatmap
mirror: https://gitlab.com/markuman/gitea-user-heatmap
demo: https://git.osuv.de/m/
#6
The text was updated successfully, but these errors were encountered: