New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WHEREをクエリで行うようにした #11

Merged
merged 7 commits into from Sep 18, 2018

Conversation

Projects
None yet
2 participants
@euglena1215
Copy link
Collaborator

euglena1215 commented Sep 16, 2018

No description provided.

db.query('SELECT * FROM events ORDER BY id ASC')
else
db.query('SELECT * FROM events WHERE public_fg = 1 ORDER BY id ASC')
end.to_a

This comment has been minimized.

@chigichan24

chigichan24 Sep 18, 2018

Collaborator

これ大丈夫なんですか?Ruby弱者なので不安.

This comment has been minimized.

@chigichan24

chigichan24 Sep 18, 2018

Collaborator

それぞれで.to_aしたほうがいいのかなって思った

This comment has been minimized.

@euglena1215

euglena1215 Sep 18, 2018

Author Collaborator

rubyのifは文ではなく式なので大丈夫です

irb(main):006:0> if true
irb(main):007:1> 1
irb(main):008:1> else
irb(main):009:1> 2
irb(main):010:1> end.to_s
=> "1"

This comment has been minimized.

@chigichan24

chigichan24 Sep 18, 2018

Collaborator

ほんまや,なるほど

@@ -180,6 +182,7 @@ def render_report_csv(reports_body)
get '/' do
@user = get_login_user
@events = get_events.map(&method(:sanitize_event))
p @events

This comment has been minimized.

@chigichan24

chigichan24 Sep 18, 2018

Collaborator

いらなそう

@euglena1215

This comment has been minimized.

Copy link
Collaborator Author

euglena1215 commented Sep 18, 2018

確かにremainsが違うところまでは発見した

[11] pry(#<Torb::Web>)> get_event(nil, event:event)
=> {"id"=>10,
 "title"=>"\u5E73\u6210\u72D0\u5408\u6226\u30D0\u30D6\u30EB\u7D4C\u6E08",
 "price"=>2000,
 "total"=>1000,
 "remains"=>1000,
 "sheets"=>
  {"S"=>
    {"total"=>50,
     "remains"=>50,
     "price"=>7000,
     "detail"=>
      [{"rank"=>"S", "num"=>1, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>2, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>3, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>4, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>5, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>6, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>7, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>8, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>9, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>10, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>11, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>12, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>13, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>14, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>15, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>16, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>17, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>18, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>19, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>20, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>21, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>22, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>23, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>24, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>25, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>26, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>27, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>28, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>29, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>30, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>31, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>32, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
       {"rank"=>"S", "num"=>33, "reserved_at"=>nil, "mine"=>true, "reserved"=>false},
[12] pry(#<Torb::Web>)> get_event(10)
=> {"id"=>10,
 "title"=>"\u5E73\u6210\u72D0\u5408\u6226\u30D0\u30D6\u30EB\u7D4C\u6E08",
 "price"=>2000,
 "total"=>1000,
 "remains"=>0,
 "sheets"=>
  {"S"=>
    {"total"=>50,
     "remains"=>0,
     "price"=>7000,
     "detail"=>
      [{"rank"=>"S", "num"=>1, "reserved_at"=>1410264588, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>2, "reserved_at"=>1369880727, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>3, "reserved_at"=>1385416208, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>4, "reserved_at"=>1382078483, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>5, "reserved_at"=>1460517729, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>6, "reserved_at"=>1349363208, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>7, "reserved_at"=>1533022150, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>8, "reserved_at"=>1491194876, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>9, "reserved_at"=>1443698929, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>10, "reserved_at"=>1383376467, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>11, "reserved_at"=>1485750663, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>12, "reserved_at"=>1489559030, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>13, "reserved_at"=>1327825531, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>14, "reserved_at"=>1496864430, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>15, "reserved_at"=>1501109140, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>16, "reserved_at"=>1427348360, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>17, "reserved_at"=>1359867687, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>18, "reserved_at"=>1423569243, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>19, "reserved_at"=>1482149588, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>20, "reserved_at"=>1360940354, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>21, "reserved_at"=>1363138954, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>22, "reserved_at"=>1499343047, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>23, "reserved_at"=>1399987605, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>24, "reserved_at"=>1394706043, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>25, "reserved_at"=>1393741693, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>26, "reserved_at"=>1508810394, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>27, "reserved_at"=>1386755229, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>28, "reserved_at"=>1425463100, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>29, "reserved_at"=>1419879288, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>30, "reserved_at"=>1518753266, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>31, "reserved_at"=>1510540687, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>32, "reserved_at"=>1409689382, "mine"=>false, "reserved"=>true},
       {"rank"=>"S", "num"=>33, "reserved_at"=>1435495148, "mine"=>false, "reserved"=>true},
[13] pry(#<Torb::Web>)>
@euglena1215

This comment has been minimized.

Copy link
Collaborator Author

euglena1215 commented Sep 18, 2018

5,824

@euglena1215

This comment has been minimized.

Copy link
Collaborator Author

euglena1215 commented Sep 18, 2018

4,338 🤔

@euglena1215

This comment has been minimized.

Copy link
Collaborator Author

euglena1215 commented Sep 18, 2018

んんんんんん??????
8,028

@euglena1215

This comment has been minimized.

Copy link
Collaborator Author

euglena1215 commented Sep 18, 2018

そろそろ本丸行きますか。。。

@euglena1215 euglena1215 merged commit cd2d2a2 into master Sep 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment