Pārlūkot izejas kodu

Merge branch 'master' into sorcery

master
Adrian Short pirms 12 gadiem
vecāks
revīzija
73ab79350c
4 mainītis faili ar 30 papildinājumiem un 0 dzēšanām
  1. +6
    -0
      app/controllers/posts_controller.rb
  2. +8
    -0
      app/models/error_log.rb
  3. +9
    -0
      test/fixtures/error_logs.yml
  4. +7
    -0
      test/unit/error_log_test.rb

+ 6
- 0
app/controllers/posts_controller.rb Parādīt failu

@@ -4,6 +4,12 @@ class PostsController < ApplicationController
def near
@posts = Post.near(params[:lat].to_f, params[:lon].to_f, params[:radius].to_f)

ErrorLog.create(
:ts => Time.now,
:params => params,
:pois_returned => @posts.size
)

layar_response = {
:layer => 'hyparlocal',
:hotspots => @posts.collect { |p| post_to_poi(p) },


+ 8
- 0
app/models/error_log.rb Parādīt failu

@@ -0,0 +1,8 @@
class ErrorLog
include MongoMapper::Document

key :ts, Time
key :params, Hash
key :pois_returned, Integer

end

+ 9
- 0
test/fixtures/error_logs.yml Parādīt failu

@@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html

one:
ts: 2012-07-06
params:

two:
ts: 2012-07-06
params:

+ 7
- 0
test/unit/error_log_test.rb Parādīt failu

@@ -0,0 +1,7 @@
require 'test_helper'

class ErrorLogTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

Notiek ielāde…
Atcelt
Saglabāt