Skip to content

Commit

Permalink
Modify current user function & add percent function
Browse files Browse the repository at this point in the history
  • Loading branch information
ciciswann committed Feb 14, 2021
1 parent 99aae56 commit c8c7cae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/Helpers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def logged_in?
end

def current_user
@current_user ||= User.find(session[:user_id]) if session[user_id]
User.find(session[:user_id])
end

def not_the_owner?(obj)
Expand All @@ -15,4 +15,8 @@ def not_the_owner?(obj)
end
end

def percent_complete(completed, total)
p ((completed.to_f/total.to_f) * 100).round
end

end

0 comments on commit c8c7cae

Please sign in to comment.