Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
1181a832
Commit
1181a832
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Caching join date
parent
5a9aeb78
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cutecoin/core/person.py
+2
-3
2 additions, 3 deletions
src/cutecoin/core/person.py
src/cutecoin/gui/member.py
+6
-1
6 additions, 1 deletion
src/cutecoin/gui/member.py
with
8 additions
and
4 deletions
src/cutecoin/core/person.py
+
2
−
3
View file @
1181a832
...
@@ -146,7 +146,6 @@ class Person(object):
...
@@ -146,7 +146,6 @@ class Person(object):
return
person
return
person
@classmethod
@classmethod
#TODO: Remove name from person, contats should not use the person class
def
from_json
(
cls
,
json_data
):
def
from_json
(
cls
,
json_data
):
'''
'''
Create a person from json data
Create a person from json data
...
@@ -197,7 +196,7 @@ class Person(object):
...
@@ -197,7 +196,7 @@ class Person(object):
signature
)
signature
)
raise
PersonNotFoundError
(
self
.
pubkey
,
community
.
name
)
raise
PersonNotFoundError
(
self
.
pubkey
,
community
.
name
)
#TODO: Cache this data by returning only the timestamp instead of a datetime object
@cached
def
get_join_date
(
self
,
community
):
def
get_join_date
(
self
,
community
):
'''
'''
Get the person join date.
Get the person join date.
...
@@ -211,7 +210,7 @@ class Person(object):
...
@@ -211,7 +210,7 @@ class Person(object):
membership_data
=
None
membership_data
=
None
if
len
(
search
[
'
memberships
'
])
>
0
:
if
len
(
search
[
'
memberships
'
])
>
0
:
membership_data
=
search
[
'
memberships
'
][
0
]
membership_data
=
search
[
'
memberships
'
][
0
]
return
datetime
.
datetime
.
fromtimestamp
(
community
.
get_block
(
membership_data
[
'
blockNumber
'
]).
mediantime
).
strftime
(
"
%d/%m/%Y %I:%M
"
)
return
community
.
get_block
(
membership_data
[
'
blockNumber
'
]).
mediantime
else
:
else
:
return
None
return
None
except
ValueError
as
e
:
except
ValueError
as
e
:
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/member.py
+
6
−
1
View file @
1181a832
from
cutecoin.core.graph
import
Graph
import
datetime
from
PyQt5.QtWidgets
import
QDialog
from
PyQt5.QtWidgets
import
QDialog
from
..core.graph
import
Graph
from
..gen_resources.member_uic
import
Ui_DialogMember
from
..gen_resources.member_uic
import
Ui_DialogMember
...
@@ -20,6 +24,7 @@ class MemberDialog(QDialog, Ui_DialogMember):
...
@@ -20,6 +24,7 @@ class MemberDialog(QDialog, Ui_DialogMember):
self
.
label_uid
.
setText
(
person
.
name
)
self
.
label_uid
.
setText
(
person
.
name
)
join_date
=
self
.
person
.
get_join_date
(
self
.
community
)
join_date
=
self
.
person
.
get_join_date
(
self
.
community
)
join_date
=
datetime
.
datetime
.
fromtimestamp
(
join_date
).
strftime
(
"
%d/%m/%Y %I:%M
"
)
if
join_date
is
None
:
if
join_date
is
None
:
join_date
=
'
not a member
'
join_date
=
'
not a member
'
...
...
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