mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
add: user headmap
This commit is contained in:
26
app/controllers/users/headmaps_controller.rb
Normal file
26
app/controllers/users/headmaps_controller.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
class Users::HeadmapsController < Users::BaseController
|
||||
def index
|
||||
result = Gitea::User::HeadmapService.call(observed_user.login, start_stamp, end_stamp)
|
||||
@headmaps = result[2]
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
def start_stamp
|
||||
if params[:year].present?
|
||||
Date.new(params[:year], 1).to_time.to_i
|
||||
else
|
||||
Date.today.to_time.to_i - 365*24*60*60
|
||||
end
|
||||
end
|
||||
|
||||
def end_stamp
|
||||
if params[:year].present?
|
||||
Date.new(params[:year], 1).to_time.to_i + 365*24*60*60
|
||||
else
|
||||
Date.today.to_time.to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user