Skip to content

Commit

Permalink
fix(Runs): do not clear alerts on extra notification
Browse files Browse the repository at this point in the history
  • Loading branch information
domtra committed Oct 31, 2024
1 parent f5aae8c commit d434f1a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion includes/services/class-test-run-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Vrts\Core\Utilities\Url_Helpers;
use Vrts\Features\Service;
use Vrts\Features\Subscription;
use Vrts\Models\Alert;
use Vrts\Models\Test;
use Vrts\Models\Test_Run;
use Vrts\Services\Email_Service;
Expand All @@ -23,11 +24,13 @@ public function update_run_from_api_data( $data ) {
$test_run = Test_Run::get_by_service_test_run_id( $run_id );

$test_run_just_finished = false;
$alert_ids = [];
$alert_ids = $test_run ? maybe_unserialize( $test_run->alerts ) : [];

if ( $test_run && empty( $test_run->finished_at ) && ! empty( $data['finished_at'] ) ) {
$test_run_just_finished = true;
$alert_ids = $this->update_tests_and_create_alerts( $data['comparisons'], $test_run );
} elseif ( $test_run && ! empty( $test_run->finished_at ) ) {
$alert_ids = ! empty( $alert_ids ) ? $alert_ids : array_column(Alert::get_items_by_test_run( $test_run->id ), 'id');
}

$test_ids = empty( $data['comparison_schedule_ids'] ) ? [] : array_map(function( $test ) {
Expand Down

0 comments on commit d434f1a

Please sign in to comment.