Skip to content

Commit

Permalink
changed formatting of dates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdonthemic committed Jun 19, 2012
1 parent 7b6c3f4 commit 2da4dea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions app/controllers/quizes_controller.rb
Expand Up @@ -67,12 +67,13 @@ def results_by_member
@challenge_detail = Challenges.find_by_id(current_access_token, params[:id])[0]
@todays_results = QuickQuizes.winners_today(current_access_token, params[:id], 'all')
begin
p params[:date]
date = Date.parse params[:date]
@answers = SfdcConnection.admin_dbdc_client.query("select Id, Quick_Quiz__r.Member__r.Name, Is_Correct__c, Elapsed_Time_Seconds__c, Elapsed_Time__c, Type__c, Display_Time__c from Quick_Quiz_Answer__c where Quick_Quiz__r.Quiz_Date__c = #{date.strftime("%Y-%d-%m")} and Quick_Quiz__r.Member__r.Name = '#{params[:member]}' and Quick_Quiz__r.Challenge__r.Challenge_Id__c = '#{params[:id]}' and Status__c = 'Answered'")
@answers = SfdcConnection.admin_dbdc_client.query("select Id, Quick_Quiz__r.Member__r.Name, Is_Correct__c, Elapsed_Time_Seconds__c, Elapsed_Time__c, Type__c, Display_Time__c from Quick_Quiz_Answer__c where Quick_Quiz__r.Quiz_Date__c = #{date.strftime("%Y-%m-%d")} and Quick_Quiz__r.Member__r.Name = '#{params[:member]}' and Quick_Quiz__r.Challenge__r.Challenge_Id__c = '#{params[:id]}' and Status__c = 'Answered'")
flash.now[:warning] = "There are no results for #{params[:member]} for this date. Try changing the username or date in the URL." unless @answers.size > 0
rescue
rescue Exception => exc
@answers = []
flash.now[:error] = "Please enter a valid date."
flash.now[:error] = "Please enter a valid date. #{exc}"
end

end
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_quickquiz-sidebar.html.erb
Expand Up @@ -12,7 +12,7 @@
<% end %>

<span>View <%= link_to "all leaderboards", quizleaderboard_path(params[:id]) %> or the <%= link_to "daily winners", quizwinners_path(params[:id]) %>.</span>
<% if signed_in? %><p>Wanna see how a specific member did on a certain day? Plug the username and date into <%= link_to "this URL", quizresults_by_member_path(params[:id], current_user.username, DateTime.now.strftime("%m-%d-%Y")) %>.</p><% end %>
<% if signed_in? %><p>Wanna see how a specific member did on a certain day? Plug the username and date into <%= link_to "this URL", quizresults_by_member_path(params[:id], current_user.username, DateTime.now.strftime("%Y-%m-%d")) %>.</p><% end %>
<div style="margin-bottom:25px"></div>

<% rank = 0 %>
Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.

0 comments on commit 2da4dea

Please sign in to comment.