Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
db69878d
Commit
db69878d
authored
Jul 29, 2013
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Embedded date formatting into __unicode__
parent
e63e417e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
history.py
blink/history.py
+19
-24
No files found.
blink/history.py
View file @
db69878d
...
...
@@ -117,32 +117,27 @@ class HistoryEntry(object):
return
cls
(
remote_identity
,
remote_uri
,
unicode
(
session
.
account
.
id
),
call_time
,
duration
)
def
__unicode__
(
self
):
result
=
unicode
(
self
.
remote_identity
)
if
self
.
call_time
:
time
=
'
%
s'
%
format_date
(
self
.
call_time
)
else
:
time
=
''
days
=
(
date
.
today
()
-
self
.
call_time
.
date
())
.
days
if
days
==
0
:
result
+=
self
.
call_time
.
strftime
(
" at
%
H:
%
M"
)
elif
days
==
1
:
result
+=
self
.
call_time
.
strftime
(
" Yesterday at
%
H:
%
M"
)
elif
days
<
7
:
result
+=
self
.
call_time
.
strftime
(
" on
%
A"
)
elif
days
<
365
:
result
+=
self
.
call_time
.
strftime
(
" on
%
B
%
d"
)
else
:
result
+=
self
.
call_time
.
strftime
(
" on
%
Y-
%
m-
%
d"
)
if
self
.
duration
:
duration
=
' for '
result
+
=
' for '
if
self
.
duration
.
days
>
0
or
self
.
duration
.
seconds
>
3600
:
duration
+=
'
%
i hours, '
%
(
self
.
duration
.
days
*
3600
*
24
+
int
(
self
.
duration
.
seconds
/
3600
))
result
+=
'
%
i hours, '
%
(
self
.
duration
.
days
*
3600
*
24
+
int
(
self
.
duration
.
seconds
/
3600
))
secs
=
self
.
duration
.
seconds
%
3600
duration
+=
'
%02
i:
%02
i'
%
(
int
(
secs
/
60
),
secs
%
60
)
else
:
duration
=
''
reason
=
'
%
s'
%
self
.
reason
.
title
()
if
self
.
reason
else
''
return
u'
%
s
%
s
%
s
%
s'
%
(
self
.
remote_identity
,
time
,
duration
,
reason
)
def
format_date
(
when
):
days
=
(
date
.
today
()
-
when
.
date
())
.
days
if
days
==
0
:
return
when
.
strftime
(
"at
%
H:
%
M"
)
elif
days
==
1
:
return
when
.
strftime
(
"Yesterday at
%
H:
%
M"
)
elif
days
<
7
:
return
when
.
strftime
(
"on
%
A"
)
elif
days
<
365
:
return
when
.
strftime
(
"on
%
B
%
d"
)
else
:
return
when
.
strftime
(
"on
%
Y-
%
m-
%
d"
)
result
+=
'
%02
i:
%02
i'
%
(
int
(
secs
/
60
),
secs
%
60
)
if
self
.
reason
:
result
+=
'
%
s'
%
self
.
reason
.
title
()
return
result
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment