server/posts: change comment-time behavior
Rather than looking at the edit time, now it looks at the creation time.
This commit is contained in:
parent
b1b261beb8
commit
40565e82ae
|
@ -167,7 +167,7 @@ class PostSearchConfig(BaseSearchConfig):
|
|||
('last-edit-date', 'last-edit-time', 'edit-date', 'edit-time'):
|
||||
search_util.create_date_filter(db.Post.last_edit_time),
|
||||
('comment-date', 'comment-time'):
|
||||
search_util.create_date_filter(db.Post.last_comment_edit_time),
|
||||
search_util.create_date_filter(db.Post.last_comment_creation_time),
|
||||
('fav-date', 'fav-time'):
|
||||
search_util.create_date_filter(db.Post.last_favorite_time),
|
||||
('feature-date', 'feature-time'):
|
||||
|
@ -196,7 +196,7 @@ class PostSearchConfig(BaseSearchConfig):
|
|||
('last-edit-date', 'last-edit-time', 'edit-date', 'edit-time'):
|
||||
(db.Post.last_edit_time, self.SORT_DESC),
|
||||
('comment-date', 'comment-time'):
|
||||
(db.Post.last_comment_edit_time, self.SORT_DESC),
|
||||
(db.Post.last_comment_creation_time, self.SORT_DESC),
|
||||
('fav-date', 'fav-time'):
|
||||
(db.Post.last_favorite_time, self.SORT_DESC),
|
||||
('feature-date', 'feature-time'):
|
||||
|
|
|
@ -420,9 +420,9 @@ def test_filter_by_comment_date(
|
|||
comment1 = comment_factory(post=post1)
|
||||
comment2 = comment_factory(post=post2)
|
||||
comment3 = comment_factory(post=post3)
|
||||
comment1.last_edit_time = datetime.datetime(2014, 1, 1)
|
||||
comment2.last_edit_time = datetime.datetime(2015, 1, 1)
|
||||
comment3.last_edit_time = datetime.datetime(2016, 1, 1)
|
||||
comment1.creation_time = datetime.datetime(2014, 1, 1)
|
||||
comment2.creation_time = datetime.datetime(2015, 1, 1)
|
||||
comment3.creation_time = datetime.datetime(2016, 1, 1)
|
||||
db.session.add_all([post1, post2, post3, comment1, comment2, comment3])
|
||||
verify_unpaged(input, expected_post_ids)
|
||||
|
||||
|
|
Loading…
Reference in New Issue