Skip to content

Commit

Permalink
refacktor string splitting and show version on the website
Browse files Browse the repository at this point in the history
  • Loading branch information
holgern committed Feb 5, 2019
1 parent 24c8a5b commit 1a6b5ae
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
5 changes: 3 additions & 2 deletions homepage/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from steemrewarding.pending_vote_storage import PendingVotesTrx
from steemrewarding.failed_vote_log_storage import FailedVoteLogTrx
from steemrewarding.account_storage import AccountsDB
from steemrewarding.version import version as rewardingversion
DEBUG = True
DEBUG = False

Expand Down Expand Up @@ -405,7 +406,7 @@ def check_access_token(*args, **kwargs):
@login
def main():
name = steemconnect.me()["name"]
return render_template('welcome.html', user=name)
return render_template('welcome.html', user=name, rewardingversion=rewardingversion)

@app.route('/logout')
def logout():
Expand All @@ -424,7 +425,7 @@ def logout():
@login
def welcome():
name = steemconnect.me()["name"]
return render_template('welcome.html', user=name)
return render_template('welcome.html', user=name, rewardingversion=rewardingversion)

@app.route('/show_rules', methods=['GET'])
@login
Expand Down
5 changes: 5 additions & 0 deletions homepage/templates/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ <h3 class="card-title text-center">Welcome {{ user }} </h3>
</ul>

</div>
<div class="card">
steemrewarding version: {{rewardingversion}}
<br>
<a href="https://github.com/holgern/steemrewarding"> github </a>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ascii = codecs.lookup('ascii')
codecs.register(lambda name, enc=ascii: {True: enc}.get(name == 'mbcs'))

VERSION = '0.1.1'
VERSION = '0.1.2'

tests_require = ['mock >= 2.0.0', 'pytest', 'pytest-mock', 'parameterized']

Expand Down
21 changes: 17 additions & 4 deletions steemrewarding/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,22 @@ def upvote_comment(c_comment, acc_vote_name, acc_vote_weight):
cnt += 1
return vote_sucessfull

def split_string(string):
if string.find(",") == -1 and string.strip().find(" ") > -1:
string = string.strip().split(" ")
elif string.find(",") == -1 and string.strip().find(";") > -1:
string = string.strip().split(";")
else:
string = string.split(",")
return string

def tags_included(include_tags, tags):
tags_included = True
if include_tags is not None and include_tags != "":
tags_included = False
for tag in include_tags.split(","):
include_tags = split_string(include_tags)

for tag in include_tags:
if tag.find("&") == -1:
if tag.lower().strip() in tags:
tags_included = True
Expand All @@ -66,7 +76,9 @@ def tags_excluded(exclude_tags, tags):
tags_excluded = True
if exclude_tags is not None and exclude_tags != "":
tags_excluded = True
for tag in exclude_tags.split(","):
exclude_tags = split_string(exclude_tags)

for tag in exclude_tags:
if tag.find("&") == -1:
if tag.lower().strip() in tags:
tags_excluded = False
Expand All @@ -80,7 +92,8 @@ def tags_excluded(exclude_tags, tags):

def string_excluded(exclude_rule, string):
if exclude_rule is not None and exclude_rule != "":
exclude_rule = exclude_rule.split(",")
exclude_rule = split_string(exclude_rule)

excluded = True
for s in exclude_rule:
if s.lower().strip() == string:
Expand All @@ -91,7 +104,7 @@ def string_excluded(exclude_rule, string):

def string_included(include_rule, string):
if include_rule is not None and include_rule != "":
include_rule = include_rule.split(",")
include_rule = split_string(include_rule)
include = False
for s in include_rule:
if s.lower().strip() == string:
Expand Down
2 changes: 1 addition & 1 deletion steemrewarding/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""THIS FILE IS GENERATED FROM beem SETUP.PY."""
version = '0.1.1'
version = '0.1.2'

0 comments on commit 1a6b5ae

Please sign in to comment.