-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from InspectorIncognito/feat/EDD-2961-alert-ch…
…anges Feat/edd 2961 alert changes
- Loading branch information
Showing
7 changed files
with
157 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.1.1 on 2024-08-20 00:10 | ||
|
||
from django.db import migrations, models | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('rest_api', '0021_alertthreshold'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='segment', | ||
name='segment_id', | ||
field=models.UUIDField(default=uuid.uuid4), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from rest_api.factories import SegmentFactory, SpeedFactory, StopFactory, AlertFactory | ||
from rest_api.tests.tests_views_base import BaseTestCase | ||
from rest_api.util.alert import TranSappSiteManager | ||
from unittest import skip | ||
from rest_api.util.alert import update_alert_from_admin | ||
|
||
|
||
class TestManager(BaseTestCase): | ||
def setUp(self): | ||
self.manager = TranSappSiteManager() | ||
self.segment = SegmentFactory() | ||
|
||
@skip('Skipping') | ||
def test_edit(self): | ||
segment_obj = SegmentFactory(segment_id='82342493-ae05-4ea0-910a-80459ac52447') | ||
StopFactory(stop_id='PD335', segment=segment_obj) | ||
|
||
speed_obj = SpeedFactory(segment=segment_obj) | ||
alert_obj = AlertFactory(segment=segment_obj, detected_speed=speed_obj) | ||
segment_uuid = segment_obj.segment_id | ||
|
||
response = self.manager.alert_lookup(segment_uuid) | ||
data = response["data"] | ||
if len(data) > 0: | ||
alert_data = data[0] | ||
update_alert_from_admin(self.manager, alert_obj, alert_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from gtfs_rt.processors.speed import calculate_speed | ||
from rest_api.util.alert import send_alerts | ||
from rest_api.util.alert import create_alerts, send_alerts | ||
|
||
|
||
def calculate_speed_and_check_alerts(): | ||
calculate_speed() | ||
create_alerts() | ||
send_alerts() |