Changeset 1753 for trunk/grails-app/controllers/HomeController.groovy
- Timestamp:
- Apr 12, 2011, 12:04:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/HomeController.groovy
r1692 r1753 53 53 def startDate, endDate, date, userTotal, studyTotal, templateTotal 54 54 def dailyStatistics = [:] 55 if (db == "org.postgresql.Driver" ) {55 if (db == "org.postgresql.Driver" && studyCount) { 56 56 //sql.eachRow("SELECT b.*,(select cast( now() - '120 day'::interval * random() as date) FROM Template c WHERE c.id=b.id) as newDate FROM Template b WHERE b.id IN (SELECT id FROM Template a)") {sql.execute(sprintf("UPDATE Template SET date_created='%s' WHERE id=%s", it.newDate, it.id))} 57 57 def studiesPerDay = sql.rows("SELECT DISTINCT date_trunc('day', a.date_created) as day, (SELECT count(b.*) FROM study b WHERE date_trunc('day', b.date_created) = date_trunc('day', a.date_created)) as count FROM study a ORDER BY day ASC")
Note: See TracChangeset
for help on using the changeset viewer.