This commit is contained in:
@@ -15,14 +15,14 @@ def test_all_daily_stats():
|
||||
crud.create_counter("Test2", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-1 days'), 2),
|
||||
(1, date(date(), '-3 days'), 3),
|
||||
(2, date(), 2),
|
||||
(2, date(date(), '-1 days'), 4),
|
||||
(2, date(date(), '-3 days'), 6)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), '-1 days'), 2),
|
||||
(1, 1, date(date(), '-3 days'), 3),
|
||||
(2, 1, date(), 2),
|
||||
(2, 1, date(date(), '-1 days'), 4),
|
||||
(2, 1, date(date(), '-3 days'), 6)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
@@ -41,11 +41,11 @@ def test_daily_stats():
|
||||
crud.create_counter("Test", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-1 days'), 2),
|
||||
(1, date(date(), '-3 days'), 3)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), '-1 days'), 2),
|
||||
(1, 1, date(date(), '-3 days'), 3)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
@@ -62,14 +62,14 @@ def test_all_monthly_stats():
|
||||
crud.create_counter("Test2", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-1 month'), 2),
|
||||
(1, date(date(), '-3 months'), 3),
|
||||
(2, date(), 2),
|
||||
(2, date(date(), '-2 months'), 4),
|
||||
(2, date(date(), '-3 months'), 6)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), 'start of month', '-1 month'), 2),
|
||||
(1, 1, date(date(), 'start of month', '-3 months'), 3),
|
||||
(2, 1, date(), 2),
|
||||
(2, 1, date(date(), 'start of month', '-2 months'), 4),
|
||||
(2, 1, date(date(), 'start of month', '-3 months'), 6)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
@@ -87,11 +87,11 @@ def test_monthly_stats():
|
||||
crud.create_counter("Test", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-1 months'), 2),
|
||||
(1, date(date(), '-3 months'), 3)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), '-1 months'), 2),
|
||||
(1, 1, date(date(), '-3 months'), 3)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
@@ -108,14 +108,14 @@ def test_all_yearly_stats():
|
||||
crud.create_counter("Test2", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-1 year'), 2),
|
||||
(1, date(date(), '-3 years'), 3),
|
||||
(2, date(), 2),
|
||||
(2, date(date(), '-2 years'), 4),
|
||||
(2, date(date(), '-3 years'), 6)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), '-1 year'), 2),
|
||||
(1, 1, date(date(), '-3 years'), 3),
|
||||
(2, 1, date(), 2),
|
||||
(2, 1, date(date(), '-2 years'), 4),
|
||||
(2, 1, date(date(), '-3 years'), 6)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
@@ -133,11 +133,11 @@ def test_yearly_stats():
|
||||
crud.create_counter("Test", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-1 years'), 2),
|
||||
(1, date(date(), '-3 years'), 3)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), '-1 years'), 2),
|
||||
(1, 1, date(date(), '-3 years'), 3)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
@@ -154,14 +154,14 @@ def test_all_weekly_stats():
|
||||
crud.create_counter("Test2", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-7 days'), 2),
|
||||
(1, date(date(), '-21 days'), 3),
|
||||
(2, date(), 2),
|
||||
(2, date(date(), '-14 days'), 4),
|
||||
(2, date(date(), '-21 days'), 6)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), '-7 days'), 2),
|
||||
(1, 1, date(date(), '-21 days'), 3),
|
||||
(2, 1, date(), 2),
|
||||
(2, 1, date(date(), '-14 days'), 4),
|
||||
(2, 1, date(date(), '-21 days'), 6)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
@@ -179,11 +179,11 @@ def test_weekly_stats():
|
||||
crud.create_counter("Test", CounterType.SIMPLE, "020122")
|
||||
with connection().session as session:
|
||||
query = text("""
|
||||
INSERT INTO entries (counter_id, "timestamp", increment)
|
||||
INSERT INTO entries (counter_id, user_id, "timestamp", increment)
|
||||
VALUES
|
||||
(1, date(), 1),
|
||||
(1, date(date(), '-7 days'), 2),
|
||||
(1, date(date(), '-21 days'), 3)
|
||||
(1, 1, date(), 1),
|
||||
(1, 1, date(date(), '-7 days'), 2),
|
||||
(1, 1, date(date(), '-21 days'), 3)
|
||||
""")
|
||||
session.execute(query)
|
||||
session.commit()
|
||||
|
||||
Reference in New Issue
Block a user