Skip to content

Commit

Permalink
Removed obsolete unique SIID exception try-catch block
Browse files Browse the repository at this point in the history
unique siid SQL index is not used for 1 year to enable card sharing
during one run
  • Loading branch information
fvacek committed Mar 28, 2020
1 parent c7027ea commit 836bf67
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
32 changes: 5 additions & 27 deletions quickevent/app/plugins/Competitors/src/competitorwidget.cpp
Expand Up @@ -33,7 +33,7 @@ namespace qfc = qf::core;
namespace qfs = qf::core::sql;

namespace {

/*
class BadDataInputException : public std::runtime_error
{
public:
Expand All @@ -44,7 +44,7 @@ class BadDataInputException : public std::runtime_error
private:
QString m_message;
};

*/
class RunsModel : public quickevent::core::og::SqlTableModel
{
Q_DECLARE_TR_FUNCTIONS(RunsModel)
Expand Down Expand Up @@ -386,31 +386,9 @@ bool CompetitorWidget::saveData()
qf::qmlwidgets::dialogs::MessageBox::showWarning(this, tr("Class should be entered."));
return false;
}
qf::core::model::DataDocument::EditState edit_state = doc->saveEditState();
bool ret = false;
try {
//qf::core::sql::Transaction transaction;
//doc->setSaveSiidToRuns(true);
if(Super::saveData())
ret = saveRunsTable();
//transaction.commit();
}
catch (BadDataInputException &e) {
qf::qmlwidgets::dialogs::MessageBox::showError(this, e.message());
}
catch (qf::core::Exception &e) {
QString what = e.message();
if(what.contains(QLatin1String("runs.stageId")) && what.contains(QLatin1String("runs.siId"))) {
// "UNIQUE constraint failed: runs.stageId, runs.siId Unable to fetch row"
// duplicate SI insertion attempt
qf::qmlwidgets::dialogs::MessageBox::showError(this, tr("Duplicate SI inserted."));
}
else {
qf::qmlwidgets::dialogs::MessageBox::showException(this, e);
}
doc->restoreEditState(edit_state);
}
return ret;
if(Super::saveData())
return saveRunsTable();
return false;
}


11 changes: 0 additions & 11 deletions quickevent/app/plugins/Relays/src/relaywidget.cpp
Expand Up @@ -36,17 +36,6 @@ namespace qfs = qf::core::sql;

namespace {

class BadDataInputException : public std::runtime_error
{
public:
BadDataInputException(const QString &message) : std::runtime_error(""), m_message(message) {}
~BadDataInputException() Q_DECL_OVERRIDE {}

const QString& message() const {return m_message;}
private:
QString m_message;
};

class LegsModel : public quickevent::core::og::SqlTableModel
{
Q_DECLARE_TR_FUNCTIONS(LegsModel)
Expand Down
2 changes: 1 addition & 1 deletion quickevent/make-dist.sh 100644 → 100755
Expand Up @@ -3,7 +3,7 @@
#APP_VER=0.0.1
APP_NAME=quickevent
SRC_DIR=/home/fanda/proj/quickbox
QT_DIR=/home/fanda/programs/qt5/5.13.2/gcc_64
QT_DIR=/home/fanda/programs/qt5/5.14.1/gcc_64
WORK_DIR=/home/fanda/t/_distro

APP_IMAGE_TOOL=/home/fanda/programs/appimagetool-x86_64.AppImage
Expand Down

0 comments on commit 836bf67

Please sign in to comment.