Repository: RocketMap/RocketMap

Issue:
Empty RAIDs/Eggs keep getting put into database and sent over webhooks
<!--

  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!

  Join discord (channel: #help) for support at this link: https://discord.gg/rocketmap
  
  Submit feature requests @ http://vote.devkat.org
  
-->

<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
The only items in the 'raid' database table should be active and/or have valid information.

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
I am seeing 100's of empty rows show up in the 'raid' database table.  If you delete them then they return immediately.  They came back even after clearing the database.

![image](https://user-images.githubusercontent.com/15407947/28951344-0003edf4-7890-11e7-9488-c84b3ccc495c.png)

I am seeing this information constantly send to webhooks:

![image](https://user-images.githubusercontent.com/15407947/28951439-9d08fcb6-7890-11e7-982d-d309b107db75.png)

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->
Make sure that empty raids/eggs are not tracked/stored during runtime
Make sure that empty raids/eggs are not written to database

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1. Ran a map with gym info enabled

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
It's a performance impact because Rocketmap seems to be constantly writing this info to database (it reappears right after you delete it) and it is sending the information to webhooks

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Environment name and version (e.g. Python 2.7):
* Operating System and version (desktop or mobile):
Ubuntu 16.04



Discussion:
I believe this is the time since last egg? Maybe I'm wrong. But if that is it then we need that info for when eggs come back (presumably after Zapdos). 
Does turning off wh-type:eggs stop it from going to webhooks? 
The huge negative times @ PokeAlarm from the webhook are that way because if you look at the information in the database all of these invalid entries have a timestamp of 00:00:00 Coordinated Universal Time (UTC) and that is getting passed over the webhook

Resolving patch:
diff --git a/pogom/models.py b/pogom/models.py
--- a/pogom/models.py
+++ b/pogom/models.py
@@ -2204,7 +2204,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue,
                 }
 
                 if config['parse_raids'] and f.type == 0:
-                    if raid_info:
+                    if f.HasField('raid_info'):
                         raids[f.id] = {
                             'gym_id': f.id,
                             'level': raid_info.raid_level,


Test patch: