Skip to content
This repository has been archived by the owner on Apr 15, 2018. It is now read-only.

Commit

Permalink
replace NodeStatus.reply_count with NodeStatus.reputation
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed May 14, 2013
1 parent 2165927 commit b2729f6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
2 changes: 1 addition & 1 deletion june/models/node.py
Expand Up @@ -51,7 +51,7 @@ class NodeStatus(db.Model, SessionMixin):
account_id = db.Column(db.Integer, primary_key=True)

topic_count = db.Column(db.Integer, default=0)
reply_count = db.Column(db.Integer, default=0)
reputation = db.Column(db.Integer, default=0)

updated = db.Column(
db.DateTime,
Expand Down
21 changes: 0 additions & 21 deletions june/models/topic.py
Expand Up @@ -100,8 +100,6 @@ def move(self, node=None):
ns.topic_count += 1
db.session.add(ns)

#TODO NodeStatus of replies

self.node_id = node.id
db.session.add(self)
db.session.commit()
Expand Down Expand Up @@ -166,18 +164,6 @@ def save(self, user=None, topic=None):
topic.reply_count += 1
db.session.add(topic)

ns = NodeStatus.query.filter_by(
node_id=topic.node_id, account_id=self.account_id
).first()
if not ns:
ns = NodeStatus(
node_id=topic.node_id,
account_id=self.account_id,
reply_count=0,
)
ns.reply_count += 1
db.session.add(ns)

db.session.add(self)
db.session.commit()
return self
Expand All @@ -188,13 +174,6 @@ def delete(self, user=None, topic=None):

topic.reply_count -= 1
db.session.add(topic)

ns = NodeStatus.query.filter_by(
node_id=topic.node_id, account_id=self.account_id
).first()
if ns and ns.reply_count:
ns.reply_count -= 1
db.session.add(ns)
db.session.delete(self)
db.session.commit()
return self
2 changes: 1 addition & 1 deletion june/templates/node/view.html
Expand Up @@ -75,7 +75,7 @@
<div class="wrap"><strong>{{status.topic_count}}</strong> {{_('Topics')}}</div>
</div>
<div class="status-item">
<div class="wrap"><strong>{{status.reply_count}}</strong> {{_('Replies')}}</div>
<div class="wrap"><strong>{{status.reputation}}</strong> {{_('Reputation')}}</div>
</div>
</div>
<div class="module-footer inner">
Expand Down

0 comments on commit b2729f6

Please sign in to comment.