Fix the database usage for finding snipes, so it doesn't find completed snipes as current.
| 556 | 569 | |
|---|---|---|
| 1764 | 1764 | return getRealDatabase().count_by("ended = 1"); |
| 1765 | 1765 | } |
| 1766 | 1766 | |
| 1767 | private static final String snipeFinder = "(snipe_id IS NOT NULL OR multisnipe_id IS NOT NULL) AND ended != 1"; | |
| 1768 | ||
| 1767 | 1769 | public static int snipedCount() { |
| 1768 | return getRealDatabase().count_by("(snipe_id IS NOT NULL OR multisnipe_id IS NOT NULL)"); | |
| 1770 | return getRealDatabase().count_by(snipeFinder); | |
| 1769 | 1771 | } |
| 1770 | 1772 | |
| 1771 | 1773 | public static AuctionEntry nextSniped() { |
| 1772 | String sql = "SELECT entries.* FROM entries, auctions WHERE " + | |
| 1773 | "(entries.snipe_id IS NOT NULL OR entries.multisnipe_id IS NOT NULL) AND " + | |
| 1774 | "ended != 1 AND " + | |
| 1775 | "(entries.auction_id = auctions.id) " + | |
| 1776 | "ORDER BY auctions.ending_at ASC"; | |
| 1774 | String sql = "SELECT entries.* FROM entries, auctions WHERE " + snipeFinder + | |
| 1775 | " AND (entries.auction_id = auctions.id) ORDER BY auctions.ending_at ASC"; | |
| 1777 | 1776 | return (AuctionEntry) findFirstBySQL(AuctionEntry.class, sql); |
| 1778 | 1777 | } |
| 1779 | 1778 | |
