Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
8ab3a78a
Commit
8ab3a78a
authored
Apr 29, 2015
by
Matija Obreza
Browse files
FIXED
#8
: Crop stats on institute page
parent
a57b7db2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/servlet/controller/WiewsController.java
View file @
8ab3a78a
...
...
@@ -32,6 +32,7 @@ import org.genesys2.server.model.genesys.Taxonomy2;
import
org.genesys2.server.model.impl.FaoInstitute
;
import
org.genesys2.server.service.ContentService
;
import
org.genesys2.server.service.DownloadService
;
import
org.genesys2.server.service.ElasticService
;
import
org.genesys2.server.service.FilterConstants
;
import
org.genesys2.server.service.GenesysService
;
import
org.genesys2.server.service.GeoService
;
...
...
@@ -42,6 +43,7 @@ import org.genesys2.server.service.TaxonomyService;
import
org.genesys2.server.service.impl.FilterHandler
;
import
org.genesys2.server.service.impl.FilterHandler.AppliedFilter
;
import
org.genesys2.server.service.impl.FilterHandler.AppliedFilters
;
import
org.genesys2.server.service.impl.SearchException
;
import
org.genesys2.spring.ResourceNotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Scope
;
...
...
@@ -87,6 +89,9 @@ public class WiewsController extends BaseController {
@Autowired
private
StatisticsService
statisticsService
;
@Autowired
private
ElasticService
elasticService
;
@RequestMapping
(
"/"
)
public
String
view
(
ModelMap
model
,
@RequestParam
(
value
=
"page"
,
required
=
false
,
defaultValue
=
"1"
)
int
page
)
{
model
.
addAttribute
(
"pagedData"
,
instituteService
.
listPGRInstitutes
(
new
PageRequest
(
page
-
1
,
50
,
new
Sort
(
"code"
))));
...
...
@@ -128,6 +133,17 @@ public class WiewsController extends BaseController {
long
datasetCount
=
genesysService
.
countDatasets
(
faoInstitute
);
model
.
addAttribute
(
"datasetCount"
,
datasetCount
);
{
AppliedFilters
instituteFilter
=
new
AppliedFilters
();
instituteFilter
.
add
(
new
AppliedFilter
().
setFilterName
(
FilterConstants
.
INSTCODE
).
addFilterValue
(
new
FilterHandler
.
LiteralValueFilter
(
faoInstitute
.
getCode
())));
try
{
model
.
addAttribute
(
"statisticsCrops"
,
elasticService
.
termStatisticsAuto
(
instituteFilter
,
FilterConstants
.
CROPS
,
5
));
}
catch
(
SearchException
e
)
{
_logger
.
warn
(
e
.
getMessage
());
}
}
model
.
addAttribute
(
"statisticsGenus"
,
genesysService
.
statisticsGenusByInstitute
(
faoInstitute
,
new
PageRequest
(
0
,
30
)));
model
.
addAttribute
(
"statisticsTaxonomy"
,
genesysService
.
statisticsSpeciesByInstitute
(
faoInstitute
,
new
PageRequest
(
0
,
30
)));
model
.
addAttribute
(
"statisticsPDCI"
,
statisticsService
.
statisticsPDCI
(
faoInstitute
));
...
...
src/main/webapp/WEB-INF/jsp/wiews/details.jsp
View file @
8ab3a78a
...
...
@@ -147,23 +147,15 @@
</div>
</c:if>
<%-- <h3>
<spring:message code="faoInstitute.statistics" />
</h3> --%>
<div
class=
"row"
style=
"margin-top: 2em;"
>
<%-- <c:if test="${statisticsCrop ne null}">
<div class="col-sm-4">
<h4><spring:message code="faoInstitute.stat-by-crop" arguments="${statisticsCrop.numberOfElements}" /></h4>
<ul class="funny-list statistics">
<c:forEach items="${statisticsCrop.content}" var="stat" varStatus="status">
<li class="clearfix ${status.count % 2 == 0 ? 'even' : 'odd'}"><span class="stats-number"><fmt:formatNumber value="${stat[1]}" /></span> <a href="<c:url value="/wiews/${faoInstitute.code}/" />"><c:out value="${stat[0].getName(pageContext.response.locale)}" /></a></li>
</c:forEach>
</ul>
</div>
</c:if> --%>
<c:if
test=
"
${
statisticsCrops
ne
null
}
"
>
<div
class=
"col-xs-12"
>
<h4>
<spring:message
code=
"faoInstitute.stat-by-crop"
/>
</h4>
<local:term
-result termResult="${statisticsCrops}" type="crop"
/>
</div>
</c:if>
<div
class=
"col-sm-6"
>
<h4>
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment