Commit 823f1acb by Kevin Chugh

formatting issues

parent 03ddd086
post "#{APIPREFIX}/notifications" do
#get all notifications for a set of users and a range of dates
#for example
#http://localhost:4567/api/v1/notifications?api_key=PUT_YOUR_API_KEY_HERE
#with POST params
#user_ids=1217716,196353
#from=2013-03-18+13%3A52%3A47+-0400
#to=2013-03-19+13%3A53%3A11+-0400
#note this takes date format 8601 year-month-day-(hours:minutes:seconds difference from UTC
# get all notifications for a set of users and a range of dates
# for example
# http://localhost:4567/api/v1/notifications?api_key=PUT_YOUR_API_KEY_HERE
# with POST params
# user_ids=1217716,196353
# from=2013-03-18+13%3A52%3A47+-0400
# to=2013-03-19+13%3A53%3A11+-0400
# note this takes date format 8601 year-month-day-(hours:minutes:seconds difference from UTC
notifications_by_date_range_and_user_ids(CGI.unescape(params[:from]).to_time, CGI.unescape(params[:to]).to_time,params[:user_ids].split(','))
end
......@@ -241,31 +241,31 @@ helpers do
c.abuse_flaggers.to_a.empty? and
c.historical_abuse_flaggers.to_a.empty?
user_ids = subscriptions_map[c.comment_thread_id.to_s]
user_ids.each do |u|
if not notification_map.keys.include? u
notification_map[u] = {}
user_ids = subscriptions_map[c.comment_thread_id.to_s]
user_ids.each do |u|
if not notification_map.keys.include? u
notification_map[u] = {}
end
if not notification_map[u].keys.include? c.course_id
notification_map[u][c.course_id] = {}
end
if not notification_map[u][c.course_id].include? c.comment_thread_id.to_s
t = notification_map[u][c.course_id][c.comment_thread_id.to_s] = {}
t["content"] = []
t["title"] = current_thread.title
t["commentable_id"] = current_thread.commentable_id
else
t = notification_map[u][c.course_id][c.comment_thread_id.to_s]
end
content_obj = {}
content_obj["username"] = c.author_with_anonymity(:username, "(anonymous)")
content_obj["updated_at"] = c.updated_at
content_obj["body"] = c.body
t["content"] << content_obj
end
if not notification_map[u].keys.include? c.course_id
notification_map[u][c.course_id] = {}
end
if not notification_map[u][c.course_id].include? c.comment_thread_id.to_s
t = notification_map[u][c.course_id][c.comment_thread_id.to_s] = {}
t["content"] = []
t["title"] = current_thread.title
t["commentable_id"] = current_thread.commentable_id
else
t = notification_map[u][c.course_id][c.comment_thread_id.to_s]
end
content_obj = {}
content_obj["username"] = c.author_with_anonymity(:username, "(anonymous)")
content_obj["updated_at"] = c.updated_at
content_obj["body"] = c.body
t["content"] << content_obj
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment