Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def matches_this_week(client)
- matches.find_by_sql("SELECT * FROM matches m INNER JOIN participations p ON p.match_id = m.id INNER JOIN players pl ON p.player_id = pl.id INNER JOIN timeslots t ON t.match_id = m.id INNER JOIN courts c ON t.court_id = c.id INNER JOIN clients cl ON c.client_id = cl.id WHERE cl.id = :client AND pl.id = :player AND t.begin_datetime > :start AND t.end_datetime < :end", {:client => client.id, :player => id, :start => DateTime.now.beginning_of_week, :end => DateTime.now.end_of_week}).count
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement