#!/bin/bash # TimeSafari Daily Migration Summary # Usage: ./daily-migration-summary.sh LOG_FILE="migration-times.log" TODAY=$(date +"%Y-%m-%d") echo "📊 Daily Migration Summary - $TODAY" echo "==================================" if [ ! -f "$LOG_FILE" ]; then echo "❌ No migration log found. Start tracking with ./time-migration.sh" exit 1 fi # Count components completed today COMPLETED_TODAY=$(grep "^.*,$TODAY" "$LOG_FILE" | grep -v ",,,," | wc -l) TOTAL_TIME=$(grep "^.*,$TODAY" "$LOG_FILE" | grep -v ",,,," | cut -d',' -f4 | awk '{sum+=$1} END {print sum}') if [ "$COMPLETED_TODAY" -eq 0 ]; then echo "No components completed today" exit 0 fi # Calculate average time AVG_TIME=$(echo "scale=1; $TOTAL_TIME / $COMPLETED_TODAY" | bc -l) echo "Components completed today: $COMPLETED_TODAY" echo "Total time spent: $TOTAL_TIME minutes" echo "Average time per component: $AVG_TIME minutes" echo # Show today's completions echo "Today's Completions:" echo "===================" grep "^.*,$TODAY" "$LOG_FILE" | grep -v ",,,," | while IFS=',' read -r component start end duration complexity issues commit; do echo "✅ $component ($duration minutes) - $commit" done echo # Show overall progress TOTAL_COMPLETED=$(grep -v "Component,Start Time" "$LOG_FILE" | grep -v ",,,," | wc -l) REMAINING=$((92 - TOTAL_COMPLETED)) echo "Overall Progress:" echo "==================" echo "Total components: 92" echo "Completed: $TOTAL_COMPLETED" echo "Remaining: $REMAINING" echo "Progress: $(echo "scale=1; $TOTAL_COMPLETED * 100 / 92" | bc -l)%" # Estimate completion time if [ "$TOTAL_COMPLETED" -gt 0 ]; then OVERALL_AVG=$(grep -v "Component,Start Time" "$LOG_FILE" | grep -v ",,,," | cut -d',' -f4 | awk '{sum+=$1} END {print sum/'$TOTAL_COMPLETED'}') ESTIMATED_HOURS=$(echo "scale=1; $REMAINING * $OVERALL_AVG / 60" | bc -l) echo "Estimated remaining time: $ESTIMATED_HOURS hours" fi