fix(android): root field inventory at inspection Yacimiento
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
name: F6.1 Android Yacimiento root
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'hotfix/f6-1-inspection-planning-hierarchy'
|
||||
paths:
|
||||
- '.github/workflows/f6-1-android-yacimiento-root.yml'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
apply:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: hotfix/f6-1-inspection-planning-hierarchy
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Align Android field root with frozen Yacimiento scope
|
||||
run: |
|
||||
python - <<'PY'
|
||||
from pathlib import Path
|
||||
|
||||
dh = Path('android-app/app/src/main/java/com/korexlabs/dhinspeccion/data/DhMobile.kt')
|
||||
text = dh.read_text()
|
||||
before = '''data class VisitDetail(\n val id: String,\n val code: String,\n val objective: String? = null,\n val status: String,\n val operationalArea: AssetSummary? = null,'''
|
||||
after = '''data class VisitDetail(\n val id: String,\n val code: String,\n val objective: String? = null,\n val status: String,\n val scopeAsset: AssetSummary? = null,\n val operationalArea: AssetSummary? = null,'''
|
||||
if text.count(before) != 1:
|
||||
raise SystemExit(f'VisitDetail insertion: {text.count(before)}')
|
||||
dh.write_text(text.replace(before, after))
|
||||
|
||||
vm = Path('android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt')
|
||||
text = vm.read_text()
|
||||
replacements = {
|
||||
'inventoryParentId = visit?.operationalArea?.id': 'inventoryParentId = visit?.scopeAsset?.id ?: visit?.operationalArea?.id',
|
||||
'val effectiveParentId = parentId ?: inventoryParentId ?: currentVisit.operationalArea?.id': 'val effectiveParentId = parentId ?: inventoryParentId ?: currentVisit.scopeAsset?.id ?: currentVisit.operationalArea?.id',
|
||||
'val effectiveParentId = parentId ?: currentVisit.operationalArea?.id': 'val effectiveParentId = parentId ?: currentVisit.scopeAsset?.id ?: currentVisit.operationalArea?.id',
|
||||
'val effectiveParentId = inventoryParentId ?: visit?.operationalArea?.id': 'val effectiveParentId = inventoryParentId ?: visit?.scopeAsset?.id ?: visit?.operationalArea?.id',
|
||||
}
|
||||
for before, after in replacements.items():
|
||||
count = text.count(before)
|
||||
if count < 1:
|
||||
raise SystemExit(f'MainViewModel root missing: {before}')
|
||||
text = text.replace(before, after)
|
||||
vm.write_text(text)
|
||||
|
||||
Path('.github/workflows/f6-1-android-yacimiento-root.yml').unlink()
|
||||
PY
|
||||
|
||||
- name: Verify Android root contract
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
grep -Fq 'val scopeAsset: AssetSummary? = null' android-app/app/src/main/java/com/korexlabs/dhinspeccion/data/DhMobile.kt
|
||||
grep -Fq 'currentVisit.scopeAsset?.id ?: currentVisit.operationalArea?.id' android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt
|
||||
grep -Fq 'visit?.scopeAsset?.id ?: visit?.operationalArea?.id' android-app/app/src/main/java/com/korexlabs/dhinspeccion/MainViewModel.kt
|
||||
|
||||
- name: Commit Android scope fix
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
git config user.name 'github-actions[bot]'
|
||||
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||
git add android-app .github/workflows/f6-1-android-yacimiento-root.yml
|
||||
git diff --cached --check
|
||||
git commit -m 'fix(android): root field inventory at inspection Yacimiento'
|
||||
git push origin HEAD:hotfix/f6-1-inspection-planning-hierarchy
|
||||
Reference in New Issue
Block a user