##// END OF EJS Templates
scm: code clean up RepositoriesController....
Toshi MARUYAMA -
r5497:ca5ce92cfcb9
parent child
Show More
@@ -192,7 +192,6 class RepositoriesController < ApplicationController
192 User.current.pref[:diff_type] = @diff_type
192 User.current.pref[:diff_type] = @diff_type
193 User.current.preference.save
193 User.current.preference.save
194 end
194 end
195
196 @cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}")
195 @cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}")
197 unless read_fragment(@cache_key)
196 unless read_fragment(@cache_key)
198 @diff = @repository.diff(@path, @rev, @rev_to)
197 @diff = @repository.diff(@path, @rev, @rev_to)
@@ -261,11 +260,15 class RepositoriesController < ApplicationController
261 @date_to = Date.today
260 @date_to = Date.today
262 @date_from = @date_to << 11
261 @date_from = @date_to << 11
263 @date_from = Date.civil(@date_from.year, @date_from.month, 1)
262 @date_from = Date.civil(@date_from.year, @date_from.month, 1)
264 commits_by_day = repository.changesets.count(:all, :group => :commit_date, :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
263 commits_by_day = repository.changesets.count(
264 :all, :group => :commit_date,
265 :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
265 commits_by_month = [0] * 12
266 commits_by_month = [0] * 12
266 commits_by_day.each {|c| commits_by_month[c.first.to_date.months_ago] += c.last }
267 commits_by_day.each {|c| commits_by_month[c.first.to_date.months_ago] += c.last }
267
268
268 changes_by_day = repository.changes.count(:all, :group => :commit_date, :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
269 changes_by_day = repository.changes.count(
270 :all, :group => :commit_date,
271 :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
269 changes_by_month = [0] * 12
272 changes_by_month = [0] * 12
270 changes_by_day.each {|c| changes_by_month[c.first.to_date.months_ago] += c.last }
273 changes_by_day.each {|c| changes_by_month[c.first.to_date.months_ago] += c.last }
271
274
@@ -326,20 +329,16 class RepositoriesController < ApplicationController
326 :graph_title => l(:label_commits_per_author),
329 :graph_title => l(:label_commits_per_author),
327 :show_graph_title => true
330 :show_graph_title => true
328 )
331 )
329
330 graph.add_data(
332 graph.add_data(
331 :data => commits_data,
333 :data => commits_data,
332 :title => l(:label_revision_plural)
334 :title => l(:label_revision_plural)
333 )
335 )
334
335 graph.add_data(
336 graph.add_data(
336 :data => changes_data,
337 :data => changes_data,
337 :title => l(:label_change_plural)
338 :title => l(:label_change_plural)
338 )
339 )
339
340 graph.burn
340 graph.burn
341 end
341 end
342
343 end
342 end
344
343
345 class Date
344 class Date
General Comments 0
You need to be logged in to leave comments. Login now