Skip to content

Commit

Permalink
Merge pull request #59 from biodiv-platform/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
prakhar-s authored Jul 31, 2023
2 parents 6b598f4 + 5210e30 commit d59d9ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
7 changes: 3 additions & 4 deletions src/main/java/com/strandls/utility/dao/HomePageStatsDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ public HomePageStats fetchPortalStats() {
String obvQry = "select count(*) from observation where is_deleted = false";
String docQry = "select count(*) from document";
String speciesQry = "SELECT count(*) FROM public.species where is_deleted = false";
String discussionQry = "select count(*) from discussion where is_deleted= false";

String actUserQry = "select count(*) from suser where account_expired = false and is_deleted = false and enabled = true";

Long layerCount = 0L;
try {
// This is written in seprate try block so if somewhere naksha not setup it should still work
// This is written in seprate try block so if somewhere naksha not setup it
// should still work
// and not break other code
layerCount = Long.parseLong(layerServiceApi.getLayerCount().toString());
} catch (Exception e) {
Expand All @@ -45,13 +46,11 @@ public HomePageStats fetchPortalStats() {
Query<Object> obvquery = session.createNativeQuery(obvQry);
Query<Object> docQuery = session.createNativeQuery(docQry);
Query<Object> speciesQuery = session.createNativeQuery(speciesQry);
Query<Object> disQuery = session.createNativeQuery(discussionQry);
Query<Object> actUserQuery = session.createNativeQuery(actUserQry);

stats.setObservation(Long.parseLong(obvquery.getSingleResult().toString()));
stats.setDocuments(Long.parseLong(docQuery.getSingleResult().toString()));
stats.setSpecies(Long.parseLong(speciesQuery.getSingleResult().toString()));
stats.setDiscussions(Long.parseLong(disQuery.getSingleResult().toString()));
stats.setActiveUser(Long.parseLong(actUserQuery.getSingleResult().toString()));
stats.setMaps(layerCount);
} catch (Exception e) {
Expand Down
12 changes: 1 addition & 11 deletions src/main/java/com/strandls/utility/pojo/HomePageStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public class HomePageStats {
private Long observation;
private Long maps;
private Long documents;
private Long discussions;
private Long activeUser;

/**
Expand All @@ -24,13 +23,12 @@ public HomePageStats() {
* @param discussions
* @param activeUser
*/
public HomePageStats(Long species, Long observation, Long maps, Long documents, Long discussions, Long activeUser) {
public HomePageStats(Long species, Long observation, Long maps, Long documents, Long activeUser) {
super();
this.species = species;
this.observation = observation;
this.maps = maps;
this.documents = documents;
this.discussions = discussions;
this.activeUser = activeUser;
}

Expand Down Expand Up @@ -66,14 +64,6 @@ public void setDocuments(Long documents) {
this.documents = documents;
}

public Long getDiscussions() {
return discussions;
}

public void setDiscussions(Long discussions) {
this.discussions = discussions;
}

public Long getActiveUser() {
return activeUser;
}
Expand Down

0 comments on commit d59d9ff

Please sign in to comment.