Improving coding style
This commit is contained in:
parent
632397ba7b
commit
7e6ea787bd
5 changed files with 6 additions and 8 deletions
|
@ -26,7 +26,6 @@ def to_zero_count(page_no):
|
|||
"""
|
||||
Will subtract 1 from the argument it gets, converting it to an int.
|
||||
If the conversion fails or the argument it's negatives it returns zero instead.
|
||||
|
||||
>>> to_zero_count(3)
|
||||
2
|
||||
>>> to_zero_count('a')
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<td>{{ item.gpu | truncate(50) }}</td>
|
||||
<td>{{ item.cpu | truncate(50) }}</td>
|
||||
<td>{{ item.score }}</td>
|
||||
<td><a href="{{ url_for('scoreboard.result', id=item.id) }}" target="_blank">See more</a></td>
|
||||
<td><a href="{{ url_for('scoreboard.result', rid=item.id) }}" target="_blank">See more</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
|
@ -83,13 +83,13 @@ def result_post():
|
|||
|
||||
|
||||
@utilities.cache.cached(timeout=60*5)
|
||||
@scoreboard.route("/result/<id>", methods=['GET'])
|
||||
def result(id):
|
||||
@scoreboard.route("/result/<rid>", methods=['GET'])
|
||||
def result(rid):
|
||||
"""
|
||||
Fetches an entry from the database and displays it in a view.
|
||||
The entry is retrieved from the database and the ID is a primary key for the entry.
|
||||
"""
|
||||
entry_name = Result.query.filter_by(id=id).first()
|
||||
entry_name = Result.query.filter_by(id=rid).first()
|
||||
if entry_name:
|
||||
progress_bar_data = dict()
|
||||
progress_bar_data['value'] = utilities.get_progress_bar_score(entry_name.score)
|
||||
|
|
|
@ -55,7 +55,6 @@ class UtilitiesTestCase(unittest.TestCase):
|
|||
self.assertEqual(9, r)
|
||||
|
||||
def test_get_environment_variable(self):
|
||||
import os
|
||||
self.assertEqual(ut.get_env_variable("TESTING", "false"), 'false')
|
||||
os.environ['TESTING'] = 'True'
|
||||
self.assertEqual(ut.get_env_variable("TESTING", "false"), 'True')
|
||||
|
|
Loading…
Reference in a new issue