Commit c39f80bd authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor commit calendar a bit. Fixed dates

parent 815e9aa2
......@@ -4,7 +4,7 @@ class @calendar
day: "numeric"
year: "numeric"
constructor: (timestamps,starting_year,starting_month,activities_path) ->
constructor: (timestamps, starting_year, starting_month, activities_path) ->
cal = new CalHeatMap()
cal.init
itemName: ["commit"]
......
......@@ -28,8 +28,8 @@ class UsersController < ApplicationController
user_repositories = visible_projects.map(&:repository)
@timestamps = Gitlab::CommitsCalendar.create_timestamp(user_repositories,
@user, false)
@starting_year = Gitlab::CommitsCalendar.starting_year(@timestamps)
@starting_month = Gitlab::CommitsCalendar.starting_month(@timestamps)
@starting_year = (Time.now - 1.year).strftime("%Y")
@starting_month = Date.today.strftime("%m").to_i
@last_commit_date = Gitlab::CommitsCalendar.last_commit_date(@timestamps)
respond_to do |format|
......
......@@ -60,14 +60,6 @@ module Gitlab
end
end
def self.starting_year(timestamps)
DateTime.now.to_date - 1
end
def self.starting_month(timestamps)
Date.today.strftime("%m").to_i
end
def self.last_commit_date(timestamps)
latest_commit_date(timestamps).to_formatted_s(:long).to_s
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment