• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Freegle / Iznik / 11495

09 May 2026 07:35AM UTC coverage: 69.06% (-3.8%) from 72.847%
11495

Pull #408

circleci

edwh
docs(migration): mark restartproject and repaircafewales as migrated (PR #408)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pull Request #408: feat(batch): migrate check_cgas, visualise, tn_sync + dry-run improvements

9127 of 10554 branches covered (86.48%)

Branch coverage included in aggregate %.

507 of 663 new or added lines in 16 files covered. (76.47%)

11902 existing lines in 138 files now uncovered.

101630 of 149824 relevant lines covered (67.83%)

19.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.67
/iznik-batch/app/Services/GroupBoundaryService.php
1
<?php
2

3
namespace App\Services;
4

5
use Illuminate\Support\Facades\DB;
6
use Illuminate\Support\Facades\Log;
7

8
class GroupBoundaryService
9
{
10
    public function checkBoundaries(bool $dryRun = false): array
4✔
11
    {
12
        $srid = config('freegle.srid', 3857);
4✔
13

14
        $groups = DB::select(
4✔
15
            "SELECT id, nameshort, poly FROM `groups` WHERE type = 'Freegle' AND publish = 1 AND onmap = 1"
4✔
16
        );
4✔
17

18
        $total = count($groups);
4✔
19
        $errors = 0;
4✔
20

21
        if ($dryRun) {
4✔
22
            Log::info('Dry run: would check boundaries for groups', ['total' => $total]);
2✔
23
            return ['total' => $total, 'errors' => 0];
2✔
24
        }
25

26
        foreach ($groups as $group) {
2✔
27
            try {
28
                DB::select(
2✔
29
                    "SELECT ST_Intersection(ST_GeomFromText(polyofficial, ?), COALESCE(simplified, polygon))
2✔
30
                     FROM `groups`
31
                     INNER JOIN `authorities` ON type = 'Freegle' AND publish = 1 AND onmap = 1
32
                     WHERE authorities.id = 74579 AND groups.id = ?",
2✔
33
                    [$srid, $group->id]
2✔
34
                );
2✔
35

36
                if ($group->poly) {
2✔
37
                    DB::select(
2✔
38
                        "SELECT ST_Intersection(ST_GeomFromText(poly, ?), COALESCE(simplified, polygon))
2✔
39
                         FROM `groups`
40
                         INNER JOIN `authorities` ON type = 'Freegle' AND publish = 1 AND onmap = 1
41
                         WHERE authorities.id = 74579 AND groups.id = ?",
2✔
42
                        [$srid, $group->id]
2✔
43
                    );
2✔
44
                }
NEW
45
            } catch (\Throwable $e) {
×
NEW
46
                Log::error("Invalid CGA/DPA boundary for group {$group->id} {$group->nameshort}", [
×
NEW
47
                    'group_id'   => $group->id,
×
NEW
48
                    'nameshort'  => $group->nameshort,
×
NEW
49
                    'error'      => $e->getMessage(),
×
NEW
50
                ]);
×
NEW
51
                $errors++;
×
52
            }
53
        }
54

55
        return ['total' => $total, 'errors' => $errors];
2✔
56
    }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc