Changeset 1753


Ignore:
Timestamp:
Apr 12, 2011, 12:04:06 PM (6 years ago)
Author:
work@…
Message:

homecontroller breaks if database is empty

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/HomeController.groovy

    r1692 r1753  
    5353                def startDate, endDate, date, userTotal, studyTotal, templateTotal
    5454                def dailyStatistics = [:]
    55                 if (db == "org.postgresql.Driver") {
     55                if (db == "org.postgresql.Driver" && studyCount) {
    5656                        //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))}
    5757                        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.