Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions script/load_fixture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ if [ -d "$FIXTURE_DIR" ]; then
fi

echo "πŸ” Checking model: $model from $name"

count=$(python ../openIMIS/manage.py shell -c "from ${model%.*} import ${model#*.} as M; print(M.objects.count())" 2>/dev/null || echo 0)


model_class="${model#*.}"
model_class_cap="${model_class^}"
output=$(python ../openIMIS/manage.py shell -c "from django.apps import apps; M = apps.get_model('$model'); print(M.objects.count())")
count=$(echo "$output" | grep -E '^[0-9]+$' | tail -1)
if [[ -z "$count" ]]; then count=0; fi
if [[ "$count" -eq 0 ]]; then
echo "βœ… Loading fixture: $fixture_file"
if [ "$name" = "roles-right.json" ]; then
Expand All @@ -73,4 +76,4 @@ fi


echo "=== Fixture test complete for $SOLUTION_NAME ==="
exit 0
exit 0
Loading