Skip to content

Commit af6282c

Browse files
authored
feat(demo): import family lat/lng and demo data update (#8133)
## What Changed Added latitude/longitude support for demo family addresses and populated the demo dataset with coords. This change ensures demo imports persist mapping coordinates without calling external geocoders. Fixes # ## Type - [x] ✨ Feature - [ ] 🐛 Bug fix - [ ] ♻️ Refactor - [ ] 🏗️ Build/Infrastructure - [ ] 🔒 Security ## Testing - `php -l src/ChurchCRM/Service/DemoDataService.php` — no syntax errors - Import the demo data via the Admin UI (Admin → Demo Data → Import) or POST `/admin/api/demo/load` and verify families have `Latitude`/`Longitude` populated in the DB or Family view. ## Screenshots (none) ## Pre-Merge - [x] Tested locally - [ ] No new warnings - [ ] Build passes - [ ] Backward compatible (or migration documented)
2 parents 814b10f + 88a19f4 commit af6282c

File tree

6 files changed

+471
-294
lines changed

6 files changed

+471
-294
lines changed

.agents/skills/churchcrm/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Project-specific skills for AI agents and developers working on ChurchCRM. Each
8686
|-------|------------|
8787
| [Git Workflow](./git-workflow.md) | Commits, PRs, pre-commit validation |
8888
| [GitHub Interaction](./github-interaction.md) | Reviews, commits, PR management |
89+
| [PR Description Guidelines](./pr-description-guidelines.md) | Ensure PR bodies are written in Markdown with required sections (Summary, Changes, Files Changed, Validation, Testing) |
8990
| [Development Workflows](./development-workflows.md) | Setup, build, Docker management |
9091
| [Code Standards](./code-standards.md) | General coding, quality checks, PR reviews |
9192
| [Wiki Documentation](./wiki-documentation.md) | Complex documentation, admin guides |
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# PR Description Guidelines
2+
3+
When creating a pull request, always author the PR description in Markdown and include the following sections:
4+
5+
- **Summary**: One-paragraph summary of the change.
6+
- **Changes**: Short bullets describing what changed and why.
7+
- **Files Changed**: List of key files or modules changed; include links when useful.
8+
- **Validation**: How the change was validated (lint, unit tests, manual steps).
9+
- **Testing Instructions**: Steps a reviewer can follow to verify the change locally.
10+
11+
Use code blocks and Markdown lists to make examples and commands easy to copy. Keep descriptions concise and focused on reviewer needs.
12+
13+
Repository PR template
14+
---------------------
15+
16+
This repository provides a PR template at `.github/PULL_REQUEST_TEMPLATE.md`. When opening a PR, use that template as the base and fill each section before creating the PR. If using the GitHub CLI you can pass the template as the body file:
17+
18+
```bash
19+
gh pr create --title "<short title>" --body-file .github/PULL_REQUEST_TEMPLATE.md --base master --head <branch>
20+
```
21+
22+
Ensure the filled template remains in Markdown and includes the required sections (What Changed, Type, Testing, Pre-Merge checklist).
23+
24+
Safe workflow for using the repository template
25+
----------------------------------------------
26+
27+
Do NOT edit `.github/PULL_REQUEST_TEMPLATE.md` in-place. Always create a temporary copy, edit that copy, and use it when creating the PR. Example workflow (bash):
28+
29+
```bash
30+
# create a timestamped copy in /tmp (do not write to repo template)
31+
TMP_BODY="/tmp/pr_body_$(date +%s).md"
32+
cp .github/PULL_REQUEST_TEMPLATE.md "$TMP_BODY"
33+
34+
# open the copy in the user's editor
35+
${EDITOR:-vi} "$TMP_BODY"
36+
37+
# create the PR using the copy as the body; this leaves the repo template untouched
38+
gh pr create --title "<short title>" --body-file "$TMP_BODY" --base master --head <branch>
39+
40+
# optionally remove the temporary file when done
41+
rm -f "$TMP_BODY"
42+
```
43+
44+
Agents and scripts should follow this pattern whenever generating or programmatically editing PR bodies.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ Fixes #
1616

1717
## Screenshots
1818
<!-- Only for UI changes - drag & drop images here -->
19-
20-
## Security Check
21-
<!-- Only check if applicable -->
22-
- [ ] Introduces new input validation
23-
- [ ] Modifies authentication/authorization
24-
- [ ] Affects data privacy/GDPR
25-
26-
### Code Quality
27-
- [ ] Database: Propel ORM only, no raw SQL
28-
- [ ] No deprecated attributes (align, valign, nowrap, border, cellpadding, cellspacing, bgcolor)
29-
- [ ] Bootstrap CSS classes used
30-
- [ ] All CSS bundled via webpack
31-
3219
## Pre-Merge
3320
- [ ] Tested locally
3421
- [ ] No new warnings

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ This file is a pointer to the canonical development guidance for AI agents (Copi
4040
4. **Test locally** and run `npm run build` + `npm run test`
4141
5. **Request human review** before committing
4242

43+
## Pull Request Descriptions
44+
45+
- Always provide the pull request description in Markdown using the repository PR template sections: **What Changed**, **Type**, **Testing**, and **Pre-Merge**. The PR body should be human-readable and use Markdown headings, bullets, and code blocks where appropriate so agents and reviewers can render it consistently.
46+
4347
## More Info
4448

4549
- Full skill list and descriptions: [.agents/skills/README.md](../.agents/skills/README.md)

src/ChurchCRM/Service/DemoDataService.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,27 @@ private function importCongregation(): array
235235
$family->setZip($addr['zip'] ?? null);
236236
$family->setCountry($addr['country'] ?? null);
237237

238+
// If demo JSON provides lat/lng, use them to set family's location
239+
if (isset($addr['latitude']) || isset($addr['lat']) || isset($addr['longitude']) || isset($addr['lng'])) {
240+
$lat = $addr['latitude'] ?? $addr['lat'] ?? null;
241+
$lon = $addr['longitude'] ?? $addr['lng'] ?? null;
242+
if ($lat !== null && $lon !== null) {
243+
// normalize to float when possible
244+
$nLat = is_numeric($lat) ? (float)$lat : null;
245+
$nLon = is_numeric($lon) ? (float)$lon : null;
246+
if ($nLat !== null && $nLon !== null) {
247+
try {
248+
$family->setLatitude($nLat);
249+
$family->setLongitude($nLon);
250+
} catch (Exception $e) {
251+
$this->addWarning("Failed to set lat/lng for family '{$famData['name']}'", ['error' => $e->getMessage(), 'lat' => $lat, 'lon' => $lon]);
252+
}
253+
} else {
254+
$this->addWarning("Invalid lat/lng values for family '{$famData['name']}'", ['lat' => $lat, 'lon' => $lon]);
255+
}
256+
}
257+
}
258+
238259
$contact = $famData['contact'] ?? [];
239260
$phone = $contact['phone'] ?? [];
240261
$family->setHomePhone($phone['home'] ?? null);

0 commit comments

Comments
 (0)