]> git.sesse.net Git - pkanalytics/commitdiff
Fix sorting after inserting a new formation.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 29 May 2023 13:32:01 +0000 (15:32 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 29 May 2023 13:32:01 +0000 (15:32 +0200)
formations.cpp

index 55e6de8c95f7d0429c8ff79bd19e6c109c1bb914..a23469b9e21c7df044ac5d3c912f0b49533c8720 100644 (file)
@@ -70,12 +70,10 @@ unsigned FormationsModel::insert_new(const std::string &name)
                fprintf(stderr, "INSERT finalize: %s\n", sqlite3_errmsg(db));
                abort();
        }
-
-       beginResetModel();  // Simplest for our use, though not ideal.
-
        int formation_id = sqlite3_last_insert_rowid(db);
-       formations.push_back(Formation{ formation_id, name });
 
+       beginResetModel();  // Simplest for our use, though not ideal.
+       load_data();
        endResetModel();
 
        return formation_id;