sanhozay / PilotLog

Flight logging for Flightgear flight simulator
GNU General Public License v3.0
1 stars 0 forks source link

No way to delete a completed flight #12

Open sanhozay opened 3 years ago

sanhozay commented 3 years ago

The web interface does not provide a means to delete a flight.

sanhozay commented 3 years ago

The philosophy was originally that the log should be an indelible record of flights, so I never added a delete button. In practice there are times when I do want to delete flights.

The interim workaround is to make a note of the flight id from the flight detail page (click on the flight date in the flight record), then use this script. Note that deleted flights cannot be recovered, other than by restoring the H2 database from a backup.

#!/bin/sh

HOSTNAME=localhost

ECHO=/bin/echo
CURL=/usr/bin/curl

for id in "$@"
do
    $ECHO -n "Deleting flight $id - "
    $CURL -fsX DELETE http://$HOSTNAME:8080/api/flights/flight/$id > /dev/null
    if [ $? -eq 0 ]
    then
        $ECHO "ok"
    else
        $ECHO "failed"
    fi
done