Skip to content

Commit

Permalink
kk
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertz committed Jun 13, 2015
1 parent 119e724 commit b6b445a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/models/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def user_name
end
end

def is_new_user
self.user.created_at > self.created_at - 12.hours
end


def self.check_per_day(user_id,game_id,beacon_id)
Check.where("user_id = ? and game_id = ? and beaconid =? and created_at >= ? and created_at <= ?" , user_id, game_id, beacon_id, Date.today.beginning_of_day, Date.today.end_of_day).length
end
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/records/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<th>app name</th>
<th>qr</th>
<th>from user</th>
<th>social value</th>
<th>score</th>
<th>allocation</th>
<th>remark</th>
Expand All @@ -28,6 +29,7 @@
<td><%= link_to r.app_name, "/admin/records?game_id=#{r.game_id}" %></td>
<td><img src="<%= r.get_qr_img %>" width='100px'></td>
<td><%= link_to r.from_user_name, "/admin/records?from_user_id=#{r.from_user_id}" %></td>
<td><%= r.user.social_value(r.beaconid) %></td>
<td><%= r.score %></td>
<td><%= r.allocation%></td>
<td><%= r.remark %></td>
Expand Down
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150610094023) do
ActiveRecord::Schema.define(version: 20150612013512) do

create_table "ads", force: true do |t|
t.string "title"
Expand Down Expand Up @@ -205,6 +205,7 @@
t.datetime "updated_at"
t.integer "game_id"
t.datetime "last_notice_time"
t.integer "new_state"
end

add_index "checks", ["beaconid"], name: "index_checks_on_beaconid", using: :btree
Expand Down

0 comments on commit b6b445a

Please sign in to comment.