Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
7db56fd9
Commit
7db56fd9
authored
6 years ago
by
crokkon
Browse files
Options
Downloads
Patches
Plain Diff
vote.py: use reputation calculation from utils
parent
bf47221a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beem/vote.py
+4
-17
4 additions, 17 deletions
beem/vote.py
with
4 additions
and
17 deletions
beem/vote.py
+
4
−
17
View file @
7db56fd9
...
...
@@ -14,7 +14,7 @@ from beemgraphenebase.py23 import integer_types, string_types, text_type
from
.instance
import
shared_steem_instance
from
.account
import
Account
from
.exceptions
import
VoteDoesNotExistsException
from
.utils
import
resolve_authorperm
,
resolve_authorpermvoter
,
construct_authorpermvoter
,
construct_authorperm
,
formatTimeString
,
addTzInfo
from
.utils
import
resolve_authorperm
,
resolve_authorpermvoter
,
construct_authorpermvoter
,
construct_authorperm
,
formatTimeString
,
addTzInfo
,
reputation_to_score
from
.blockchainobject
import
BlockchainObject
from
.comment
import
Comment
from
beemapi.exceptions
import
UnkownKey
...
...
@@ -164,14 +164,7 @@ class Vote(BlockchainObject):
@property
def
rep
(
self
):
rep
=
int
(
self
.
reputation
)
if
rep
==
0
:
return
25.
score
=
max
([
math
.
log10
(
abs
(
rep
))
-
9
,
0
])
if
rep
<
0
:
score
*=
-
1
score
=
(
score
*
9.
)
+
25.
return
score
return
reputation_to_score
(
self
.
reputation
)
@property
def
time
(
self
):
...
...
@@ -187,18 +180,12 @@ class VotesObject(list):
if
sort_key
==
'
sbd
'
:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
self
.
rshares
,
reverse
=
reverse
)
elif
sort_key
==
'
voter
'
:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
self
[
sort_key
],
reverse
=
reverse
)
elif
sort_key
==
'
time
'
:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
(
utc
.
localize
(
datetime
.
utcnow
())
-
formatTimeString
(
self
.
time
)).
total_seconds
(),
reverse
=
reverse
)
elif
sort_key
==
'
rshares
'
:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
self
[
sort_key
],
reverse
=
reverse
)
elif
sort_key
==
'
percent
'
:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
self
[
sort_key
],
reverse
=
reverse
)
elif
sort_key
==
'
weight
'
:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
self
[
sort_key
],
reverse
=
reverse
)
elif
sort_key
==
'
votee
'
:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
self
.
votee
,
reverse
=
reverse
)
elif
sort_key
in
[
'
voter
'
,
'
rshares
'
,
'
percent
'
,
'
weight
'
]:
sortedList
=
sorted
(
self
,
key
=
lambda
self
:
self
[
sort_key
],
reverse
=
reverse
)
else
:
sortedList
=
self
return
sortedList
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment