Skip to content

Commit

Permalink
Only display charts for active currencies (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
utdrmac authored and rnevet committed Mar 31, 2018
1 parent 47ee811 commit 94c3a58
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/Charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def on_bot_init(self):
self.last_dump = 0
self.dump_interval = int(self.config.get("CHARTS", "DumpInterval", 21600))
self.history_file = self.config.get("CHARTS", "HistoryFile", "www/history.json")
self.activeCurrencies = self.config.get_all_currencies()


def before_lending(self):
Expand All @@ -43,9 +44,12 @@ def dump_history(self):
cursor = self.db.cursor()

data = { }
placeholder = '?'
placeholders = ', '.join(placeholder for unused in self.activeCurrencies)

# Get distinct coins
cursor.execute("SELECT DISTINCT currency FROM history ORDER BY currency DESC")
query = "SELECT DISTINCT currency FROM history WHERE currency IN (%s) ORDER BY currency DESC" % placeholders
cursor.execute(query, self.activeCurrencies)
for i in cursor:
data[i[0]] = []

Expand Down

0 comments on commit 94c3a58

Please sign in to comment.