Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def teste3 = {
- def userStats = []
- def textoS
- def email = Users.get(5559).email
- def dtInicio, dtFim
- use(TimeCategory){
- dtInicio = new Date() - 1.months
- dtFim = new Date() + 1.days
- }
- def sql = Sql.newInstance( 'jdbc:postgresql://localhost:5432/ad', 'postgres',
- 'postgres', 'org.postgresql.Driver' )
- sql.eachRow('select count(prog_title) contagem, prog_title,users.email from programmation join alert on programmation.id = alert.program_id join users on alert.user_id = users.id where users.email=\''+email+'\' and alert.hora_dispara between \''+dtInicio+'\' and \''+dtFim+'\' group by alert.user_id, prog_title,email order by contagem desc limit 10 ') {
- userStats.add(new UserStats(program_title:it.prog_title,user_email:it.email,frequencia:it.contagem))
- }
- if(userStats == null){
- }else{
- textoS = 'TvMEGAzineP Top ' + userStats.size() + ' Programms:\n\n'
- userStats.each{ us ->
- textoS = textoS + '\t\t\t\t - ' + us.program_title + '\n'
- }
- }
- FbUtil fb = new FbUtil()
- fb.sendComent(Users.get(5559).fbtoken, textoS)
- }
Add Comment
Please, Sign In to add comment