@@ 324,7 324,11 @@ class TelSelections
end
define_method(:sql_query) do
- ["SELECT * FROM tel_inventory WHERE tel LIKE ?", "+1#{@q}%"]
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND tel LIKE ?",
+ "+1#{@q}%"
+ ]
end
}
)
@@ 354,7 358,11 @@ class TelSelections
end
def sql_query
- ["SELECT * FROM tel_inventory WHERE tel LIKE ?", "%#{q_digits}%"]
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND tel LIKE ?",
+ "%#{q_digits}%"
+ ]
end
def q_digits
@@ 390,7 398,11 @@ class TelSelections
end
def sql_query
- ["SELECT * FROM tel_inventory WHERE region = ?", @state]
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND region = ?",
+ @state
+ ]
end
def to_s
@@ 438,7 450,9 @@ class TelSelections
def sql_query
[
- "SELECT * FROM tel_inventory WHERE region = ? AND locality = ?",
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP " \
+ "AND region = ? AND locality = ?",
@state.to_s, @city
]
end
@@ 206,7 206,11 @@ class TelSelectionsTest < Minitest::Test
def test_for_area_code_sql
q = TelSelections::ChooseTel::Q.for("226")
assert_equal(
- ["SELECT * FROM tel_inventory WHERE tel LIKE ?", "+1226%"],
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND tel LIKE ?",
+ "+1226%"
+ ],
q.sql_query
)
end
@@ 219,7 223,11 @@ class TelSelectionsTest < Minitest::Test
def test_for_npanxx_sql
q = TelSelections::ChooseTel::Q.for("226666")
assert_equal(
- ["SELECT * FROM tel_inventory WHERE tel LIKE ?", "+1226666%"],
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND tel LIKE ?",
+ "+1226666%"
+ ],
q.sql_query
)
end
@@ 232,7 240,11 @@ class TelSelectionsTest < Minitest::Test
def test_for_npanxxx_sql
q = TelSelections::ChooseTel::Q.for("2266667")
assert_equal(
- ["SELECT * FROM tel_inventory WHERE tel LIKE ?", "+12266667%"],
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND tel LIKE ?",
+ "+12266667%"
+ ],
q.sql_query
)
end
@@ 255,7 267,11 @@ class TelSelectionsTest < Minitest::Test
def test_for_localvanity_sql
q = TelSelections::ChooseTel::Q.for("~mboa")
assert_equal(
- ["SELECT * FROM tel_inventory WHERE tel LIKE ?", "%6262%"],
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND tel LIKE ?",
+ "%6262%"
+ ],
q.sql_query
)
end
@@ 268,7 284,11 @@ class TelSelectionsTest < Minitest::Test
def test_for_state_sql
q = TelSelections::ChooseTel::Q.for("ON")
assert_equal(
- ["SELECT * FROM tel_inventory WHERE region = ?", "ON"],
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND region = ?",
+ "ON"
+ ],
q.sql_query
)
end
@@ 281,7 301,11 @@ class TelSelectionsTest < Minitest::Test
def test_for_state_name_sql
q = TelSelections::ChooseTel::Q.for("ontario")
assert_equal(
- ["SELECT * FROM tel_inventory WHERE region = ?", "ON"],
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND region = ?",
+ "ON"
+ ],
q.sql_query
)
end
@@ 294,7 318,11 @@ class TelSelectionsTest < Minitest::Test
def test_for_new_york_sql
q = TelSelections::ChooseTel::Q.for("New York")
assert_equal(
- ["SELECT * FROM tel_inventory WHERE region = ?", "NY"],
+ [
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP AND region = ?",
+ "NY"
+ ],
q.sql_query
)
end
@@ 316,7 344,9 @@ class TelSelectionsTest < Minitest::Test
)
assert_equal(
[
- "SELECT * FROM tel_inventory WHERE region = ? AND locality = ?",
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP " \
+ "AND region = ? AND locality = ?",
"NY", "New York City"
],
q.sql_query
@@ 340,7 370,9 @@ class TelSelectionsTest < Minitest::Test
)
assert_equal(
[
- "SELECT * FROM tel_inventory WHERE region = ? AND locality = ?",
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP " \
+ "AND region = ? AND locality = ?",
"NY", "New York City"
],
q.sql_query
@@ 364,7 396,9 @@ class TelSelectionsTest < Minitest::Test
)
assert_equal(
[
- "SELECT * FROM tel_inventory WHERE region = ? AND locality = ?",
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP " \
+ "AND region = ? AND locality = ?",
"ON", "Toronto"
],
q.sql_query
@@ 388,7 422,9 @@ class TelSelectionsTest < Minitest::Test
)
assert_equal(
[
- "SELECT * FROM tel_inventory WHERE region = ? AND locality = ?",
+ "SELECT * FROM tel_inventory " \
+ "WHERE available_after < LOCALTIMESTAMP " \
+ "AND region = ? AND locality = ?",
"ON", "Toronto"
],
q.sql_query