diff options
author | Christopher <chdxD1@users.noreply.github.com> | 2018-12-11 03:05:24 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2018-12-11 10:05:24 +0800 |
commit | 64680b72bd1b0a0fc164296ff0cc7319ae7dc4ca (patch) | |
tree | 0d196070ce83c03e3ebcbdddc4eec097df5e4c12 /models/user_heatmap.go | |
parent | 205a53364532405a6b2848cee319d7f1e5c56f16 (diff) | |
download | gitea-64680b72bd1b0a0fc164296ff0cc7319ae7dc4ca.tar.gz gitea-64680b72bd1b0a0fc164296ff0cc7319ae7dc4ca.zip |
Fixing MSSQL timestamp type (#5511)
MSSQL is using the wrong type here which results in a strconv.ParseInt: parsing "2018-12-07T00:00:00Z": invalid syntax error.
The added datediff(SECOND, '19700101', x) results in the unix timestamp to be returned.
Signed-off-by: Christopher Dziomba <christopher.dziomba@gmail.com>
Diffstat (limited to 'models/user_heatmap.go')
-rw-r--r-- | models/user_heatmap.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/models/user_heatmap.go b/models/user_heatmap.go index 9e603f4fe1..0745a66058 100644 --- a/models/user_heatmap.go +++ b/models/user_heatmap.go @@ -28,7 +28,7 @@ func GetUserHeatmapDataByUser(user *User) ([]*UserHeatmapData, error) { case setting.UsePostgreSQL: groupBy = "extract(epoch from date_trunc('day', to_timestamp(created_unix)))" case setting.UseMSSQL: - groupBy = "dateadd(DAY,0, datediff(day,0, dateadd(s, created_unix, '19700101')))" + groupBy = "datediff(SECOND, '19700101', dateadd(DAY, 0, datediff(day, 0, dateadd(s, created_unix, '19700101'))))" groupByName = groupBy } |