Advertisement
Guest User

Untitled

a guest
May 18th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 20.01 KB | None | 0 0
  1. Index: C:/fa/gailen.laura/trunk/application.properties
  2. ===================================================================
  3. --- C:/fa/gailen.laura/trunk/application.properties (revision 2360)
  4. +++ C:/fa/gailen.laura/trunk/application.properties (revision 2361)
  5. @@ -1,33 +1,33 @@
  6. -#utf-8
  7. -#Sat Nov 07 00:28:56 CET 2009
  8. -app.grails.version=1.2-M2
  9. -app.name=laura
  10. -app.servlet.version=2.4
  11. -app.version=0.1
  12. -jquery.plugins.boxy=jquery.boxy.js
  13. -jquery.plugins.colorbox=jquery.colorbox.js
  14. -jquery.plugins.colorbox-min=jquery.colorbox-min.js
  15. -jquery.plugins.fgmenu=jquery.fgmenu.js
  16. -jquery.plugins.jquery-ui=jquery-ui-1.7.1.custom.min.js
  17. -jquery.plugins.tools=jquery.tools.js
  18. -plugins.authentication=1.0
  19. -plugins.bean-fields=0.4
  20. -plugins.bubbling=2.1.1
  21. -plugins.code-coverage=1.1.7
  22. -plugins.export=0.6
  23. -plugins.fixtures=0.7
  24. -plugins.fsm=0.6.3
  25. -plugins.google-analytics=0.1
  26. -plugins.grails-template-engine=0.2
  27. -plugins.grails-ui=1.0.4
  28. -plugins.h2=0.2.6
  29. -plugins.hibernate=1.2-M2
  30. -plugins.ivy=2.0.0-rc1
  31. -plugins.jquery=1.3.2.4
  32. -plugins.mail=0.7.1
  33. -plugins.paypal=0.5
  34. -#plugins.profiler=0.2
  35. -plugins.quartz=0.4.1
  36. -plugins.searchable=0.5.5
  37. -plugins.tomcat=1.2-M2
  38. -plugins.yui=2.7.0.1
  39. +#utf-8
  40. +#Wed Feb 24 18:02:06 GMT-03:00 2010
  41. +app.grails.version=1.2-M2
  42. +app.name=laura
  43. +app.servlet.version=2.4
  44. +app.version=0.1
  45. +jquery.plugins.boxy=jquery.boxy.js
  46. +jquery.plugins.colorbox=jquery.colorbox.js
  47. +jquery.plugins.colorbox-min=jquery.colorbox-min.js
  48. +jquery.plugins.fgmenu=jquery.fgmenu.js
  49. +jquery.plugins.jquery-ui=jquery-ui-1.7.1.custom.min.js
  50. +jquery.plugins.tools=jquery.tools.js
  51. +plugins.authentication=1.0
  52. +plugins.bean-fields=0.4
  53. +plugins.bubbling=2.1.1
  54. +plugins.code-coverage=1.1.7
  55. +plugins.cookie=0.2
  56. +plugins.export=0.6
  57. +plugins.fixtures=0.7
  58. +plugins.fsm=0.6.3
  59. +plugins.google-analytics=0.1
  60. +plugins.grails-template-engine=0.2
  61. +plugins.grails-ui=1.0.4
  62. +plugins.h2=0.2.6
  63. +plugins.hibernate=1.2-M2
  64. +plugins.ivy=2.0.0-rc1
  65. +plugins.jquery=1.3.2.4
  66. +plugins.mail=0.7.1
  67. +plugins.paypal=0.5
  68. +plugins.quartz=0.4.1
  69. +plugins.searchable=0.5.5
  70. +plugins.tomcat=1.2-M2
  71. +plugins.yui=2.7.0.1
  72. Index: C:/fa/gailen.laura/trunk/grails-app/services/entradia/EntradaService.groovy
  73. ===================================================================
  74. --- C:/fa/gailen.laura/trunk/grails-app/services/entradia/EntradaService.groovy (revision 2360)
  75. +++ C:/fa/gailen.laura/trunk/grails-app/services/entradia/EntradaService.groovy (revision 2361)
  76. @@ -429,11 +429,29 @@
  77.       * @todo: Todas las operaciones realizadas en este método deberían ejecutarse
  78.       * en el marco de una transacción, para que en caso de error se pueda realizar
  79.       * un rollback y no se guarden ni las direcciones ni formas de pago ni nada
  80. +     *
  81. +     * (se carga el afiliado como null)
  82.       */
  83.      public Compra comprar(Entrada entrada, Usuario usuario, int cantidad, params) {
  84. +        comprar(entrada, usuario, null, cantidad, params)
  85. +        
  86. +    }
  87. +    
  88. +    /**
  89. +     * Usa el otro método comprar (que no tiene el parámetro afiliado)
  90. +     * @param afiliado : agrega el parámetro de afiliado por si viene de uno de los sitios
  91. +     *                   "amigos" de ticketbis
  92. +     */
  93. +    public Compra comprar(Entrada entrada, Usuario usuario, Afiliado af, int cantidad, params) {
  94.          log.debug "comprar(entrada=${entrada}, usuario=${usuario}, cantidad=${cantidad}, params=${params}"
  95. -        Compra compra = new Compra()
  96. -
  97. +        Compra compra = new Compra();
  98. +        
  99. +        // Agregamos la información del afiliado
  100. +        if (af) {
  101. +            log.debug "La compra será asociada al afiliado, ${af.token} - ${af.id}"
  102. +            compra.afiliado = af;
  103. +        }
  104. +        
  105.          // Creamos u obtenemos la direccion de entrega a utilizar.
  106.          log.debug "Procesando direccion: ${params.direccionActiva}"
  107.          Direccion direccion
  108. Index: C:/fa/gailen.laura/trunk/grails-app/services/entradia/LogVisitasService.groovy
  109. ===================================================================
  110. --- C:/fa/gailen.laura/trunk/grails-app/services/entradia/LogVisitasService.groovy  (revision 2360)
  111. +++ C:/fa/gailen.laura/trunk/grails-app/services/entradia/LogVisitasService.groovy  (revision 2361)
  112. @@ -5,18 +5,34 @@
  113.      boolean transactional = false
  114.      static profiled = true
  115.  
  116. -    def registro = [:]
  117. +    def registro = [:];
  118.  
  119.      /**
  120.       * Registra una visita para un evento
  121.       */
  122.      def visitar(ev) {
  123. -       if (ev) {
  124. -           def cantidad = registro[ev.id]?:0
  125. -           registro[ev.id] = ++cantidad
  126. -       }
  127. +        log.debug "visitar --- ev"
  128. +        visitar(ev, null);
  129.      }
  130.  
  131. +
  132. +    def visitar(ev, afiliado) {
  133. +        log.error "visitar --- ev + afiliado ---- ufffffff"
  134. +        if (ev) {
  135. +            log.debug "tengo evento?"
  136. +            // busco el evento en el registro
  137. +            def afiliadosEvento = registro[ev.id]?:[:];
  138. +            registro[ev.id] = afiliadosEvento;
  139. +            //
  140. +            def id = afiliado?.id?:-1;
  141. +            def cantidad = afiliadosEvento[id]?:0;
  142. +            afiliadosEvento[id] = ++cantidad;
  143. +            log.debug "agregado ${cantidad} el evento ${ev.nombre} y el afiliado_id ${id} "
  144. +        } else {
  145. +            log.debug "no tengo evento?"
  146. +        }
  147. +    }
  148. +
  149.      /**
  150.       * Retorna el hash de registro y lo inicializa nuevamente a cero
  151.       */
  152. Index: C:/fa/gailen.laura/trunk/grails-app/conf/LauraFilters.groovy
  153. ===================================================================
  154. --- C:/fa/gailen.laura/trunk/grails-app/conf/LauraFilters.groovy    (revision 2360)
  155. +++ C:/fa/gailen.laura/trunk/grails-app/conf/LauraFilters.groovy    (revision 2361)
  156. @@ -3,7 +3,29 @@
  157.  
  158.  class LauraFilters {
  159.      static def allowedIPs = ['192.168.*', '127.0.0.1', '0:0:0:0:0:0:0:1']
  160. +                            
  161.      def filters = {
  162. +        
  163. +        tokenAfiliado(controller:"*", action:"*") {
  164. +            before = {
  165. +                if (params.tokenAfiliado) {
  166. +                    // Validamos el afiliado
  167. +                    int lifetime = 21600
  168. +                    log.debug "Ingreso por afiliado, setearemos el cookie. ${params.tokenAfiliado} -> vida: ${lifetime}"
  169. +                    
  170. +                    Afiliado af
  171. +                    try {
  172. +                        af = Afiliado.findByToken(params.tokenAfiliado);
  173. +                    } catch (Exception e) {
  174. +                        log.warn "No se pudo setear el cookie del afiliado!";
  175. +                    }
  176. +                    
  177. +                    // lo dejamos activado por unas 6 horas...
  178. +                    response.setCookie("afiliado_id", af.id.toString(), lifetime)  
  179. +                }
  180. +            }
  181. +        }
  182. +
  183.          ipFilter(controller:"*",action:"*") {
  184.              before = {
  185.              return true
  186. @@ -20,6 +42,7 @@
  187.                  return bGo
  188.              }
  189.          }
  190. +        
  191.         sessionHack(controller:"*", action:"*") {
  192.             // TODO: Se puede quitar esto que no es eficiente??
  193.             // POR AHORA PARECE LA UNICA MANERA DE QUE ESTO FUNCIONE EN TOMCAT!!!
  194. @@ -27,15 +50,19 @@
  195.                 def session = request.session
  196.             }
  197.         }
  198. +      
  199.         homeTitle(controller:"*", action:"*") {
  200.             before = {
  201.                 request['homeTitle'] = Parametro.findByClave("home_title", [cache:true])?.valor
  202.             }
  203.         }
  204. +      
  205.         httpProtocol(controller:"*", action:"*") {
  206.             before = {
  207.                 request['httpProtocol'] = request.getScheme()
  208.             }
  209.         }
  210. +      
  211.      }
  212. +    
  213.  }
  214. Index: C:/fa/gailen.laura/trunk/grails-app/conf/entradia/LogVisitasFilters.groovy
  215. ===================================================================
  216. --- C:/fa/gailen.laura/trunk/grails-app/conf/entradia/LogVisitasFilters.groovy  (revision 2360)
  217. +++ C:/fa/gailen.laura/trunk/grails-app/conf/entradia/LogVisitasFilters.groovy  (revision 2361)
  218. @@ -1,7 +1,7 @@
  219.  package entradia
  220.  
  221.  class LogVisitasFilters {
  222. -    def logVisitasService
  223. +     LogVisitasService logVisitasService
  224.  
  225.      def filters = {
  226.  
  227. @@ -11,7 +11,23 @@
  228.           */
  229.          eventosVisitados(controller:'evento', action:'entradas') {
  230.              after = { viewModel ->
  231. -                logVisitasService.visitar( viewModel.evento )
  232. +                try {
  233. +                    def afiliado_id = request.getCookie("afiliado_id");
  234. +                    Afiliado af;
  235. +                    
  236. +                    if (afiliado_id) {
  237. +                        af = entradia.Afiliado.findById(afiliado_id)
  238. +                    }
  239. +    
  240. +                    if (af) {
  241. +                        logVisitasService.visitar( viewModel.evento, af )
  242. +                    } else {
  243. +                        logVisitasService.visitar( viewModel.evento )
  244. +                    }
  245. +                } catch (Exception e) {
  246. +                    log.error "Hubo un problema con el registro de visitas :( ", e
  247. +                }
  248. +                
  249.              }
  250.          }
  251.      }
  252. Index: C:/fa/gailen.laura/trunk/grails-app/conf/Config.groovy
  253. ===================================================================
  254. --- C:/fa/gailen.laura/trunk/grails-app/conf/Config.groovy  (revision 2360)
  255. +++ C:/fa/gailen.laura/trunk/grails-app/conf/Config.groovy  (revision 2361)
  256. @@ -74,6 +74,7 @@
  257.          emails {
  258.              alertaSeguimiento = "fniwes@gmail.com"
  259.              administradorUltimoMinuto = "fniwes@gmail.com"
  260. +           errorUPS = "fafa@soluciones3f.com.ar"
  261.          }
  262.          grails.hibernate.cache.queries = true
  263.          grails {
  264. @@ -172,6 +173,11 @@
  265.          }
  266.      }
  267.      production {
  268. +       emails {
  269. +           alertaSeguimiento = "sistemas@ticketbis.com" // se envia con la sobreventa de entradas
  270. +           administradorUltimoMinuto = "sistemas@ticketbis.com" // cuando se compran entradas pum
  271. +           errorUPS = "sistemas@ticketbis.com" // cuando hay un error con ups
  272. +       }
  273.          imagenes {
  274.              // Ruta a la carpeta donde se guardan las imagenes
  275.              path = "/home/webuser/laura-images/"
  276. @@ -233,7 +239,8 @@
  277.              }
  278.    
  279.             debug ups:"grails.app.jobs.GestorUPSJob"
  280. -           debug ups:"grails.app.service.entradia.GestorUPSService"
  281. +           debug ups:"grails.app.jobs.GestorTrackUPSJob"
  282. +           debug ups:"grails.app.service.entradia.GestorUPSService"
  283.             debug ups:"grails.app.controller.entradia.EnvioUPSController"
  284.    
  285.              debug tpv:'grails.app.service.entradia.MensajesService'
  286. @@ -263,14 +270,14 @@
  287.      // appender:
  288.      //
  289.     appenders {
  290. -        console name:'stdout', layout:pattern(conversionPattern: '%-5p %d{mm:ss,SSS}: %m [%c]%n') // [%t]
  291. -       rollingFile name:"ups", maxFileSize:2000000, file:"ups.log"
  292. -        rollingFile name:'tpv', maxFileSize:2000000, file:"tpv.log"
  293. +        console name:'stdout', additivity: false, layout:pattern(conversionPattern: '%-5p %d{mm:ss,SSS}: %m [%c]%n') // [%t]
  294. +       rollingFile name:"ups", additivity: false, maxFileSize:2000000, file:"ups.log"
  295. +        rollingFile name:'tpv', additivity: false, maxFileSize:2000000, file:"tpv.log"
  296.      }
  297.    
  298.      root {
  299.          error stdout
  300. -        additivity = true
  301. +        additivity = false
  302.      }
  303.    
  304.     debug ups:"grails.app.jobs.GestorUPSJob"
  305. @@ -282,10 +289,14 @@
  306.      debug tpv:'grails.app.service.entradia.EntradaService'
  307.      debug tpv:'grails.app.controller.entradia.PagarTPVController'
  308.      
  309. -    debug 'grails.app.controller.entradia.CompraController'
  310. +    // debug 'grails.app.controller.entradia.CompraController', 'grails.app.service'
  311.      
  312. -   // debug stdout:'grails.app.service'
  313. -   // debug stdout:'grails.app.controller'
  314. +   debug stdout:'grails.app.service'
  315. +   debug stdout:'grails.app.controller'
  316. +   debug stdout:'grails.app.filters'
  317. +   debug stdout:'grails.app.task'
  318. +        
  319. +   info 'org.hibernate'
  320.    
  321.     error  'org.codehaus.groovy.grails.web.pages', //  GSP
  322.            'org.codehaus.groovy.grails.web.sitemesh', //  layouts
  323. @@ -295,8 +306,8 @@
  324.            'org.codehaus.groovy.grails.plugins', // plugins
  325.            'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
  326.            'org.codehaus.groovy.grails.web.servlet',  //  controllers
  327. -          'org.springframework',
  328. -          'org.hibernate'
  329. +          'org.springframework'// , 'org.hibernate'
  330. +          
  331.  }
  332.  
  333.  jquery.sources="jquery"
  334. @@ -310,7 +321,8 @@
  335.                           "UsuarioAdmin" : "Usuarios",
  336.                           "DestacadosAdmin" : "Destacados",
  337.                           "FormularioAdmin" : "Formularios",
  338. -                         "SeguimientoCompraAdmin" : "Histórico"
  339. +                         "SeguimientoCompraAdmin" : "Histórico",
  340. +                         "AfiliadoAdmin" : "Afiliado"
  341.                     ]
  342.  
  343.  
  344. @@ -357,7 +369,8 @@
  345.      paginacionMisAnuncios = 10
  346.      paginacionMisVentas   = 10
  347.      paginacionMisCompras  = 10
  348. -    paginacionResumen     = 3
  349. +   paginacionMisEnvios   = 10
  350. +   paginacionResumen     = 3
  351.  }
  352.  
  353.  
  354. Index: C:/fa/gailen.laura/trunk/grails-app/conf/AdminUrlMappings.groovy
  355. ===================================================================
  356. --- C:/fa/gailen.laura/trunk/grails-app/conf/AdminUrlMappings.groovy    (revision 2360)
  357. +++ C:/fa/gailen.laura/trunk/grails-app/conf/AdminUrlMappings.groovy    (revision 2361)
  358. @@ -18,6 +18,8 @@
  359.          
  360.          "/admin/testInfraestructura/$action?/$id?" (controller: "testInfraestructuraAdmin")
  361.          "/admin/seguimientoCompra/$action?/$id?" (controller: "seguimientoCompraAdmin")
  362. +        
  363. +        "/admin/afiliado/$action?/$id?" (controller: "afiliadoAdmin")
  364.  
  365.          "/admin" ( view: "/admin/index" )
  366.     }
  367. Index: C:/fa/gailen.laura/trunk/grails-app/controllers/be/TestInfraestructuraAdminController.groovy
  368. ===================================================================
  369. --- C:/fa/gailen.laura/trunk/grails-app/controllers/be/TestInfraestructuraAdminController.groovy    (revision 2360)
  370. +++ C:/fa/gailen.laura/trunk/grails-app/controllers/be/TestInfraestructuraAdminController.groovy    (revision 2361)
  371. @@ -10,7 +10,13 @@
  372.    
  373.      def index = { }
  374.    
  375. -   def ejecutarGestorUPSJob = {
  376. +    def ejecutarLogVisitasJob = {
  377. +        def res = quartzScheduler.triggerJob("LogVisitasJob", "LauraGroup");
  378. +        render "ejecutarLogVisitasJob - ${res} - se ejecutó la tarea programada.";      
  379. +    }
  380. +
  381. +    
  382. +    def ejecutarGestorUPSJob = {
  383.         def res = quartzScheduler.triggerJob("GestorUPSJob", "UPSServices");
  384.         render "ejecutarGestorUPSJob - ${res} - se ejecutó la tarea programada.";     
  385.     }
  386. Index: C:/fa/gailen.laura/trunk/grails-app/controllers/entradia/CompraController.groovy
  387. ===================================================================
  388. --- C:/fa/gailen.laura/trunk/grails-app/controllers/entradia/CompraController.groovy    (revision 2360)
  389. +++ C:/fa/gailen.laura/trunk/grails-app/controllers/entradia/CompraController.groovy    (revision 2361)
  390. @@ -1,7 +1,7 @@
  391.  package entradia
  392.  
  393.  class CompraController {
  394. -    def entradaService
  395. +    EntradaService entradaService
  396.      def usuarioService
  397.      def authenticationService
  398.      def eventoService
  399. @@ -64,6 +64,8 @@
  400.              return render(view: "form", model: ["registro": registro, "compra": compra, "entrada": this.recuperarEntrada(), "recibirNotificaciones": recibirNotificaciones])
  401.          }
  402.  
  403. +        def afiliado = Afiliado.get(request.getCookie("afiliado_id"));
  404. +        
  405.          // Intentamos hacer efectiva la compra
  406.          if (!compra.hasErrors()) {
  407.              // anteriormente aquí se creaba una compra "temporal" que se guarda en el session hasta que
  408. @@ -79,7 +81,8 @@
  409.                        calle:           compra.envio_direccion,
  410.                        ciudad:          compra.envio_ciudad,
  411.                        codigoPostal:    compra.envio_codigoPostal,
  412. -                     pais: compra.pais,
  413. +                      pais: compra.pais,
  414. +                      afiliado: afiliado,
  415.  
  416.                        formapago_tipo:                    compra.formapago_tipo,
  417.                        formapago_tarjeta_tipo:            compra.formapago_tarjeta_tipo,
  418. @@ -90,7 +93,7 @@
  419.  
  420.                        recibirNotificaciones: compra.recibirNotificaciones,
  421.                  ]
  422. -                def entidad = entradaService.comprar( this.recuperarEntrada(), usuario, compra.cantidad, parametros )
  423. +                def entidad = entradaService.comprar( this.recuperarEntrada(), usuario, afiliado, compra.cantidad, parametros )
  424.                  
  425.                  // TODO: en caso de error hacer algo mejorcito...
  426.                  if(!entidad) return redirect(action: "parametrosIncorrectos") // se produjo un error al persistir la compra
  427. Index: C:/fa/gailen.laura/trunk/grails-app/domain/entradia/Compra.groovy
  428. ===================================================================
  429. --- C:/fa/gailen.laura/trunk/grails-app/domain/entradia/Compra.groovy   (revision 2360)
  430. +++ C:/fa/gailen.laura/trunk/grails-app/domain/entradia/Compra.groovy   (revision 2361)
  431. @@ -22,9 +22,12 @@
  432.      Date dateCreated // fecha de compra
  433.      Date lastUpdated // fecha de ultima modificacion del registro
  434.      
  435. +    String token
  436. +
  437. +    Afiliado afiliado
  438. +    
  439.      /** cosas para la entrega **/
  440.      EnvioUPS envioUPS
  441. -    String token
  442.      
  443.      // Pago de paypal
  444.      org.grails.paypal.Payment payment
  445. @@ -32,7 +35,7 @@
  446.      def afterInsert= {
  447.         token = TokenGenerator.blend(id)
  448.      }
  449. -   static def hasOne = [EnvioUPS]
  450. +   static def hasOne = [EnvioUPS, Afiliado]
  451.    
  452.      static def hasMany = [seguimientoCompras: entradia.SeguimientoCompra]
  453.  
  454. @@ -50,6 +53,7 @@
  455.          formaEnvio(nullable: true)
  456.          token(nullable: true)
  457.          envioUPS(nullable: true)
  458. +        afiliado(nullable: true)
  459.          dateCreated(nullable: true)
  460.          lastUpdated(nullable: true)
  461.          direccion(nullable: true) // debe ser nullable ya que las compra PUM no tienen direccion
  462. Index: C:/fa/gailen.laura/trunk/grails-app/domain/entradia/LogVisitaEvento.groovy
  463. ===================================================================
  464. --- C:/fa/gailen.laura/trunk/grails-app/domain/entradia/LogVisitaEvento.groovy  (revision 2360)
  465. +++ C:/fa/gailen.laura/trunk/grails-app/domain/entradia/LogVisitaEvento.groovy  (revision 2361)
  466. @@ -5,11 +5,13 @@
  467.  class LogVisitaEvento implements Serializable {
  468.  
  469.      Evento evento
  470. +    Afiliado afiliado
  471. +
  472.      Categoria raiz // Para facilitar el filtrado por categoria
  473.      long  visitas = 0
  474.      String dummy
  475.  
  476. -    static belongsTo = [evento: Evento]
  477. +    static belongsTo = [Evento, Afiliado]
  478.  
  479.      static mapping = {
  480.         cache true
  481. @@ -18,6 +20,7 @@
  482.      static constraints = {
  483.         dummy(nullable:true)
  484.         raiz(nullable:true)
  485. +       afiliado(nullable:true)
  486.      }
  487.      
  488.      def actualizaRaiz() {
  489. Index: C:/fa/gailen.laura/trunk/grails-app/jobs/LogVisitasJob.groovy
  490. ===================================================================
  491. --- C:/fa/gailen.laura/trunk/grails-app/jobs/LogVisitasJob.groovy   (revision 2360)
  492. +++ C:/fa/gailen.laura/trunk/grails-app/jobs/LogVisitasJob.groovy   (revision 2361)
  493. @@ -1,23 +1,32 @@
  494.  import entradia.LogVisitaEvento;
  495.  import entradia.Evento;
  496. +import entradia.Afiliado;
  497.  
  498.  class LogVisitasJob {
  499.      def timeout = 600000l
  500.      def logVisitasService
  501. +    def group = "LauraGroup"  
  502.  
  503.      def execute() {
  504.          def registro = logVisitasService.reset()
  505. -        registro.each { key, value ->
  506. -            log.debug "Consolidando ${key} => ${value}"
  507. +        registro.each { key, afiliados ->
  508. +            log.debug "Consolidando ${key} => ${afiliados}"
  509.              def ev = Evento.findById(key)
  510.              if(ev) {
  511. -                def log = LogVisitaEvento.findByEvento( Evento.get(key) )
  512. -                if(!log) log = new LogVisitaEvento(evento: Evento.get(key))
  513. -                log.visitas += value
  514. +                afiliados.each { afiliado_id, cantidad ->
  515. +                    log.debug "Afiliados ${afiliado_id} => ${cantidad}"
  516. +                    Afiliado af = Afiliado.findById(afiliado_id);
  517.  
  518. -                log.save()
  519. +                    def log = LogVisitaEvento.findByEventoAndAfiliado( Evento.get(key), af )
  520. +                    
  521. +                    if(!log) log = new LogVisitaEvento(evento: Evento.get(key), afiliado: af);
  522. +                    log.visitas += cantidad
  523. +    
  524. +                    log.save()
  525. +                }
  526.              }
  527.          }
  528. +
  529.      }
  530.    
  531.      static triggers = {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement