ExpandedVenture / ConnectionSphere

Simple Service to Start Prospecting Online
0 stars 0 forks source link

Message Converstion Stats Are Wrong #182

Open ExpandedVenture opened 2 years ago

ExpandedVenture commented 2 years ago

Methods:

  # ----------------------------------------------------------------------------------------- 
  # Stats
  # ----------------------------------------------------------------------------------------- 
  #
  # 
  def invitationsSent(period="W", units=1)
    trigger_type = DB["SELECT trigger_type FROM [message] WHERE [id]='#{self.id}'"].first[:trigger_type]
    if trigger_type.to_i == MESSAGE_TRIGGER_WHEN_SEND_LINKEDIN_INVITATION_TO_CONNECT.to_i
      return drx_invitations_sent("id_message", self.id, period, units)
    elsif trigger_type.to_i >= MESSAGE_TRIGGER_FOLLOWUP_1.to_i
      return 0 #drx_invitations_sent("id_message_1", self.id, period, units)
    else
      return 0
    end
  end

  def invitationsAccepted(period="W", units=1)
    trigger_type = DB["SELECT trigger_type FROM [message] WHERE [id]='#{self.id}'"].first[:trigger_type]
    if trigger_type.to_i == MESSAGE_TRIGGER_WHEN_SEND_LINKEDIN_INVITATION_TO_CONNECT.to_i || trigger_type.to_i == MESSAGE_TRIGGER_BLAST_MESSAGE.to_i
      return drx_invitations_accepted("id_message", self.id, period, units)
    elsif trigger_type.to_i >= MESSAGE_TRIGGER_FOLLOWUP_1.to_i
      return 0
    else
      return 0
    end
  end

  def introductionMessagesSent(period="W", units=1)
    trigger_type = DB["SELECT trigger_type FROM [message] WHERE [id]='#{self.id}'"].first[:trigger_type]
    if trigger_type.to_i == MESSAGE_TRIGGER_WHEN_SEND_LINKEDIN_INVITATION_TO_CONNECT.to_i || trigger_type.to_i == MESSAGE_TRIGGER_BLAST_MESSAGE.to_i
      return 0 #drx_welcome_messages_sent("id_message", self.id, period, units)
    elsif trigger_type.to_i == MESSAGE_TRIGGER_FOLLOWUP_2.to_i
      return 0
    elsif trigger_type.to_i == MESSAGE_TRIGGER_FOLLOWUP_1.to_i
      return drx_introduction_messages_sent("id_message_1", self.id, period, units)
    else
      return 0
    end
  end

  def welcomeMessagesSent(period="W", units=1)
    trigger_type = DB["SELECT trigger_type FROM [message] WHERE [id]='#{self.id}'"].first[:trigger_type]
    if trigger_type.to_i == MESSAGE_TRIGGER_WHEN_SEND_LINKEDIN_INVITATION_TO_CONNECT.to_i || trigger_type.to_i == MESSAGE_TRIGGER_BLAST_MESSAGE.to_i
      return 0 #drx_welcome_messages_sent("id_message", self.id, period, units)
    elsif trigger_type.to_i == MESSAGE_TRIGGER_FOLLOWUP_1.to_i
      return 0
    elsif trigger_type.to_i == MESSAGE_TRIGGER_FOLLOWUP_2.to_i
      return drx_welcome_messages_sent("id_message_2", self.id, period, units)
    else
      return 0
    end
  end

  def positiveRepliesReceived(period="W", units=1)
    trigger_type = DB["SELECT trigger_type FROM [message] WHERE [id]='#{self.id}'"].first[:trigger_type]
    if trigger_type.to_i == MESSAGE_TRIGGER_WHEN_SEND_LINKEDIN_INVITATION_TO_CONNECT.to_i || trigger_type.to_i == MESSAGE_TRIGGER_BLAST_MESSAGE.to_i
      #return drx_positive_replies_received("id_message", self.id, period, units)
      return drx_positive_replies_received_by_invitation_message_with_not_welcome_message(self.id, period, units)
      # TODO: develop method drx_positive_replies_received_by_invitation_message_with_not_followup_message
    elsif trigger_type.to_i == MESSAGE_TRIGGER_FOLLOWUP_1.to_i
      return 0 # TODO: develop method drx_positive_replies_received_by_introduction_message_with_not_welcome_message
    elsif trigger_type.to_i == MESSAGE_TRIGGER_FOLLOWUP_2.to_i
      return drx_positive_replies_received("id_message_1", self.id, period, units)
    else
      return 0
    end
  end

  def visits(period="W", units=1)
    # TODO: Code Me!
    0
  end

  def clicks(period="W", units=1)
    # TODO: Code Me!
    0
  end