Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
ad48332c
Commit
ad48332c
authored
Apr 15, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUGFIX] +catch in paginator
parent
b82a67ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
views.py
gargantext_web/views.py
+14
-9
corpus.html
templates/corpus.html
+1
-1
project.html
templates/project.html
+0
-1
No files found.
gargantext_web/views.py
View file @
ad48332c
...
...
@@ -321,7 +321,7 @@ def subcorpus(request, project_id, corpus_id, start , end ):
import
datetime
dateini
=
datetime
.
datetime
.
strptime
(
str
(
start
),
'
%
Y
%
m
%
d'
)
.
date
()
datefin
=
datetime
.
datetime
.
strptime
(
str
(
end
),
'
%
Y
%
m
%
d'
)
.
date
()
# print (dateini,"\t",datefin)
t
=
get_template
(
'subcorpus.html'
)
user
=
request
.
user
...
...
@@ -339,15 +339,21 @@ def subcorpus(request, project_id, corpus_id, start , end ):
# filtering documents by range-date
for
doc
in
documents
:
if
"publication_date"
in
doc
.
metadata
:
realdate
=
doc
.
metadata
[
"publication_date"
]
.
split
(
" "
)[
0
]
# in database is = (year-month-day = 2015-01-06 00:00:00 = 06 jan 2015 00 hrs)
realdate
=
datetime
.
datetime
.
strptime
(
str
(
realdate
),
'
%
Y-
%
m-
%
d'
)
.
date
()
# finalform = (yearmonthday = 20150106 = 06 jan 2015)
if
dateini
<=
realdate
<=
datefin
:
doc
.
date
=
realdate
filtered_docs
.
append
(
doc
)
try
:
realdate
=
doc
.
metadata
[
"publication_date"
]
.
split
(
" "
)[
0
]
# in database is = (year-month-day = 2015-01-06 00:00:00 = 06 jan 2015 00 hrs)
realdate
=
datetime
.
datetime
.
strptime
(
str
(
realdate
),
'
%
Y-
%
m-
%
d'
)
.
date
()
# finalform = (yearmonthday = 20150106 = 06 jan 2015)
if
dateini
<=
realdate
<=
datefin
:
doc
.
date
=
realdate
filtered_docs
.
append
(
doc
)
except
Exception
as
e
:
print
(
"pag error01 detail:"
,
e
)
print
(
"pag error01 doc:"
,
doc
)
# import pprint
# pprint.pprint(filtered_docs)
# ordering from most recent to the older.
ordered
=
sorted
(
filtered_docs
,
key
=
lambda
x
:
x
.
date
)
# pages of 10 elements. Like a sir.
paginator
=
Paginator
(
ordered
,
10
)
...
...
@@ -385,14 +391,13 @@ def subcorpusJSON(request, project_id, corpus_id, start , end ):
offset
=
str
(
end
)
except
ValueError
:
raise
Http404
()
# parameters received via web. Format = (yearmonthday = 20150106 = 06 jan 2015)
import
datetime
dateini
=
datetime
.
datetime
.
strptime
(
str
(
start
),
'
%
Y
%
m
%
d'
)
.
date
()
datefin
=
datetime
.
datetime
.
strptime
(
str
(
end
),
'
%
Y
%
m
%
d'
)
.
date
()
t
=
get_template
(
'subcorpus.html'
)
print
(
dateini
,
"
\t
"
,
datefin
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
...
...
templates/corpus.html
View file @
ad48332c
...
...
@@ -276,7 +276,7 @@ d3.csv("/chart/corpus/{{ corpus.id }}/data.csv", function (data) {
});
var
orderDates
=
Object
.
keys
(
justdates
).
reverse
();
// console.log(orderDates)
latest
=
orderDates
[
0
].
split
(
"/"
)
oldest
=
orderDates
[
orderDates
.
length
-
1
].
split
(
"/"
)
...
...
templates/project.html
View file @
ad48332c
...
...
@@ -301,7 +301,6 @@
$
(
"#id_form"
).
submit
();
}
}
}
}
...
...
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