<commit_before>require "gmail"

class EmailIntegrationController < ApplicationController

  def read


     begin

        puts "reading mail at " + Time.now.min.to_s
        
        username = "<EMAIL>"
        password = "<PASSWORD>"

        require "gmail"
        
        gmail = Gmail.new(username,password)

        gmail.inbox.emails(:unread).each do |mails|


          mail =  mails.message

          ml = TMail::Mail.parse(mail)

          tickets = Ticket.find(:all,:conditions => "title = '#{ml.subject}'")

          puts "no of tickets :" + tickets.count.to_s 

          if tickets.empty? || tickets.count == 0

              puts "found a ticket"

              ticket = Ticket.new

              ticket.title = ml.subject
              ticket.contact_id = 1
              ticket.group_id = 1
              ticket.status_id = 3
              ticket.priority_id = 3
              ticket.created_by = 1

              ticket.save

              puts "saved a ticket"

          end<commit_msg>first commit<commit_after>require "gmail"

class EmailIntegrationController < ApplicationController

  def read


     begin

        
        username = "<EMAIL>"
        password = "<PASSWORD>"

        require "gmail"
        
        gmail = Gmail.new(username,password)

        puts "reading mail at " + Time.now.min.to_s

        gmail.inbox.emails(:unread).each do |mails|


          mail =  mails.message

          ml = TMail::Mail.parse(mail)

          tickets = Ticket.find(:all,:conditions => "title = '#{ml.subject}'")

          puts "no of tickets :" + tickets.count.to_s 

          if tickets.empty? || tickets.count == 0

              puts "found a ticket"

              ticket = Ticket.new

              ticket.title = ml.subject
              ticket.contact_id = 1
              ticket.group_id = 1
              ticket.status_id = 3
              ticket.priority_id = 3
              ticket.created_by = 1

              ticket.save

              puts "saved a ticket"

          end
{'fraction_non_alphanumeric': 0.09495548961424333, 'fraction_numerical': 0.005934718100890208, 'mean_word_length': 1.4944512946979038, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3862699', 'n_tokens_mistral': 593, 'n_tokens_neox': 541, 'n_words': 130}