mirror of
https://github.com/davegallant/rfd.git
synced 2025-08-07 09:02:32 +00:00
Add view count to each thread (#53)
This commit is contained in:
@@ -1 +1 @@
|
||||
0.3.3
|
||||
0.3.4
|
||||
|
@@ -116,6 +116,9 @@ def threads(limit, forum_id):
|
||||
+ get_vote_color(thread.score)
|
||||
+ Fore.RESET
|
||||
+ "[%s] %s" % (thread.dealer_name, thread.title)
|
||||
+ Fore.LIGHTYELLOW_EX
|
||||
+ " (%d views)" % thread.total_views
|
||||
+ Fore.RESET
|
||||
)
|
||||
click.echo(Fore.BLUE + " {}".format(thread.url))
|
||||
click.echo(Style.RESET_ALL)
|
||||
|
@@ -1,10 +1,11 @@
|
||||
# pylint: disable=old-style-class
|
||||
class Thread:
|
||||
def __init__(self, title, dealer_name, score, url):
|
||||
def __init__(self, title, dealer_name, score, url, total_views):
|
||||
self.dealer_name = dealer_name
|
||||
self.score = score
|
||||
self.title = title
|
||||
self.url = url
|
||||
self.total_views = total_views
|
||||
|
||||
def __repr__(self):
|
||||
return "Thread(%s)" % self.title
|
||||
|
@@ -29,6 +29,7 @@ def parse_threads(threads, limit):
|
||||
dealer_name=topic["offer"].get("dealer_name"),
|
||||
score=calculate_score(topic),
|
||||
url=build_web_path(topic.get("web_path")),
|
||||
total_views=topic.get("total_views"),
|
||||
)
|
||||
)
|
||||
return parsed_threads
|
||||
|
Reference in New Issue
Block a user