Skip to content

Commit

Permalink
new quiz api for wes
Browse files Browse the repository at this point in the history
  • Loading branch information
ogg committed Jul 16, 2014
1 parent 96bb0e0 commit f32cf39
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/controllers/empowered_quiz_api_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class EmpoweredQuizApiController < ApplicationController
include Api::V1::Quiz
@@errors = {
:quiz_not_found => "Quiz not found"
}

#https://ec2-54-198-192-100.compute-1.amazonaws.com/api/v1/empowered_api/quiz_show_extra_attempts.json?updated_at_date=2014-04-09%2023:38:50
def quiz_show_extra_attempts
return unless authorized_action(Account.site_admin, @current_user, :become_user)
updated_at_date = params[:updated_at].to_s
result = QuizSubmission.where("extra_attempts > 0").where("updated_at >= ?", updated_at_date ).select([:user_id,:quiz_id,:updated_at,:created_at,:extra_attempts])
render :json => result.to_json
end
end

4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@
get 'quiz/:quiz_id', :action => :show_quiz, :path_name => 'show_quiz'
end

scope(:controller => :empowered_quiz_api) do
get 'empowered_api/quiz_show_extra_attempts', :action => :quiz_show_extra_attempts, :path_name => 'empowered_quiz_api'
end

scope(:controller => :wiki_api) do
get 'wiki/:wiki_id', :action => :generate, :path_name => 'generate'
end
Expand Down

0 comments on commit f32cf39

Please sign in to comment.