mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
Don't link to null projects
If you have fewer than 10 projects, then empty running projects were linked to with the path `/projects/-1`. Copy/pasted the list strategy from the other project sections in the same partial so the duplication becomes explicit.
This commit is contained in:
parent
6385059de8
commit
2686a0d3b5
3 changed files with 14 additions and 14 deletions
|
|
@ -531,7 +531,7 @@ class StatsController < ApplicationController
|
|||
|
||||
# get the first 10 projects and their running time (creation date versus
|
||||
# now())
|
||||
@projects_and_runtime_sql = current_user.projects.find_by_sql(
|
||||
@projects_and_runtime = current_user.projects.find_by_sql(
|
||||
"SELECT id, name, created_at "+
|
||||
"FROM projects "+
|
||||
"WHERE state='active' "+
|
||||
|
|
@ -539,16 +539,6 @@ class StatsController < ApplicationController
|
|||
"ORDER BY created_at ASC "+
|
||||
"LIMIT 10"
|
||||
)
|
||||
|
||||
i=0
|
||||
@projects_and_runtime = Array.new(10, [-1, t('common.not_available_abbr'), t('common.not_available_abbr')])
|
||||
@projects_and_runtime_sql.each do |r|
|
||||
days = difference_in_days(@today, r.created_at)
|
||||
# add one so that a project that you just created returns 1 day
|
||||
@projects_and_runtime[i]=[r.id, r.name, days.to_i+1]
|
||||
i += 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def get_stats_tags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue