Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove disqualified field from DB #965

Merged
merged 12 commits into from
Apr 22, 2024
80 changes: 80 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Checks:
-*,
cppcoreguidelines-*,
bugprone-*,
modernize-*,
hicpp-*,
clang-analyzer-*,
misc-*,
readability-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-integer-division,
-bugprone-macro-parentheses,
-bugprone-narrowing-conversions,
-bugprone-parent-virtual-call,
-bugprone-suspicious-missing-comma,
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-cplusplus.NewDeleteLeaks,
-clang-analyzer-optin.cplusplus.VirtualCall,
-clang-analyzer-security.FloatLoopCounter,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-explicit-virtual-functions,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-static-cast-downcast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-special-member-functions,
-hicpp-avoid-c-arrays,
-hicpp-avoid-goto,
-hicpp-braces-around-statements,
-hicpp-deprecated-headers,
-hicpp-explicit-conversions,
-hicpp-member-init,
-hicpp-multiway-paths-covered,
-hicpp-named-parameter,
-hicpp-no-array-decay,
-hicpp-signed-bitwise,
-hicpp-special-member-functions,
-hicpp-use-emplace,
-hicpp-use-equals-default,
-hicpp-use-equals-delete,
-hicpp-use-override,
-hicpp-vararg,
-misc-const-correctness,
-misc-include-cleaner,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-unused-parameters,
-modernize-pass-by-value,
-modernize-return-braced-init-list,
-modernize-use-default-member-init,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-modernize-use-using,
-readability-avoid-const-params-in-decls,
-readability-braces-around-statements,
-readability-convert-member-functions-to-static,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-implicit-bool-conversion,
-readability-inconsistent-declaration-parameter-name,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-named-parameter,
-readability-non-const-parameter,
-readability-qualified-auto,
-readability-redundant-access-specifiers,
-readability-simplify-boolean-expr,
7 changes: 7 additions & 0 deletions .github/actions/appimage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ runs:
chmod +x ./*AppImage
shell: bash

- name: Remove not needed SQL plugins
run: |
rm ${{ env.Qt6_DIR }}/plugins/sqldrivers/libqsqlmimer.so
rm ${{ env.Qt6_DIR }}/plugins/sqldrivers/libqsqlmysql.so
rm ${{ env.Qt6_DIR }}/plugins/sqldrivers/libqsqlodbc.so
shell: bash

- name: Create AppImage
run: |
LD_LIBRARY_PATH="${{ github.workspace }}/install/usr/lib:$LD_LIBRARY_PATH" \
Expand Down
9 changes: 9 additions & 0 deletions .github/actions/run-linter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ runs:
- name: Setup CMake
uses: ./.github/actions/cmake
with:
qt_version: 6.5.3
use_qt6: ON
modules: qtserialport qtmultimedia
additional_cmake_args: -DCMAKE_GLOBAL_AUTOGEN_TARGET=ON -DCMAKE_AUTOGEN_ORIGIN_DEPENDS=OFF

# workaround for clang-tidy false positive
- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8
if: runner.os == 'Linux'
with:
os: ubuntu-latest

- name: Build autogenerated stuff
shell: bash
run: cmake --build ${{github.workspace}}/build --parallel "$(nproc)" --target autogen
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup CMake
uses: ./.github/actions/cmake
with:
qt_version: 6.5.2
qt_version: 6.6.3
use_qt6: ON
modules: qtserialport qtmultimedia
additional_cmake_args: -DCMAKE_INSTALL_PREFIX='${{ github.workspace }}/install/usr'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: true

- name: Run clang-tidy
uses: ./.github/actions/run-linter
with:
Expand Down
121 changes: 54 additions & 67 deletions libquickevent/libquickeventcore/src/runstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include "og/timems.h"
#include <QCoreApplication>

namespace quickevent {
namespace core {
namespace quickevent::core {

QStringList RunStatus::runsTableColumns()
{
Expand All @@ -13,7 +12,6 @@ QStringList RunStatus::runsTableColumns()
RunStatus RunStatus::fromQuery(qf::core::sql::Query &q)
{
RunStatus new_obj;
new_obj.m_disqualified = q.value("runs.disqualified").toBool();
new_obj.m_disqualifiedByOrganizer = q.value("runs.disqualifiedByOrganizer").toBool();
new_obj.m_notCompeting = q.value("runs.notCompeting").toBool();
new_obj.m_missingPunch = q.value("runs.misPunch").toBool();
Expand All @@ -26,7 +24,6 @@ RunStatus RunStatus::fromQuery(qf::core::sql::Query &q)
RunStatus RunStatus::fromTreeTableRow(const qf::core::utils::TreeTableRow &ttr)
{
RunStatus new_obj;
new_obj.m_disqualified = ttr.value(QStringLiteral("disqualified")).toBool();
new_obj.m_disqualifiedByOrganizer = ttr.value("disqualifiedByOrganizer").toBool();
new_obj.m_notCompeting = ttr.value("notCompeting").toBool();
new_obj.m_missingPunch = ttr.value("misPunch").toBool();
Expand All @@ -38,46 +35,46 @@ RunStatus RunStatus::fromTreeTableRow(const qf::core::utils::TreeTableRow &ttr)

bool RunStatus::isOk() const
{
return !m_disqualified && !m_notCompeting;
// the `runs.disqualified` is autogenerated since 3.1.0
return !(m_disqualifiedByOrganizer
|| m_notCompeting
|| m_missingPunch
|| m_didNotStart
|| m_didNotFinish
|| m_overTime);
}

int RunStatus::ogTime() const
{
if (m_notCompeting)
return quickevent::core::og::TimeMs::NOT_COMPETITING_TIME_MSEC;
if (m_disqualified) {
if (m_disqualifiedByOrganizer)
return quickevent::core::og::TimeMs::DISQ_TIME_MSEC;
if (m_missingPunch)
return quickevent::core::og::TimeMs::MISPUNCH_TIME_MSEC;
if (m_didNotStart)
return quickevent::core::og::TimeMs::NOT_START_TIME_MSEC;
if (m_didNotFinish)
return quickevent::core::og::TimeMs::NOT_FINISH_TIME_MSEC;
if (m_overTime)
return quickevent::core::og::TimeMs::OVERTIME_TIME_MSEC;
if (m_disqualifiedByOrganizer)
return quickevent::core::og::TimeMs::DISQ_TIME_MSEC;
}
if (m_missingPunch)
return quickevent::core::og::TimeMs::MISPUNCH_TIME_MSEC;
if (m_didNotStart)
return quickevent::core::og::TimeMs::NOT_START_TIME_MSEC;
if (m_didNotFinish)
return quickevent::core::og::TimeMs::NOT_FINISH_TIME_MSEC;
if (m_overTime)
return quickevent::core::og::TimeMs::OVERTIME_TIME_MSEC;
return 0;
}

QString RunStatus::toXmlExportString() const
{
if (m_notCompeting)
return QStringLiteral("NotCompeting");
if (m_disqualified) {
if (m_disqualifiedByOrganizer)
return QStringLiteral("Disqualified");
if (m_missingPunch)
return QStringLiteral("MissingPunch");
if (m_didNotStart)
return QStringLiteral("DidNotStart");
if (m_didNotFinish)
return QStringLiteral("DidNotFinish");
if (m_overTime)
return QStringLiteral("OverTime");
if (m_disqualifiedByOrganizer)
return QStringLiteral("Disqualified");
}
if (m_missingPunch)
return QStringLiteral("MissingPunch");
if (m_didNotStart)
return QStringLiteral("DidNotStart");
if (m_didNotFinish)
return QStringLiteral("DidNotFinish");
if (m_overTime)
return QStringLiteral("OverTime");
return QStringLiteral("OK");
}

Expand All @@ -86,61 +83,51 @@ QString RunStatus::toEmmaExportString() const
{
if (m_notCompeting)
return QStringLiteral("NC ");
if (m_disqualified) {
if (m_disqualifiedByOrganizer)
return QStringLiteral("DISQ");
if (m_missingPunch)
return QStringLiteral("MP ");
if (m_didNotStart)
return QStringLiteral("DNS ");
if (m_didNotFinish)
return QStringLiteral("DNF ");
if (m_overTime)
return QStringLiteral("OVRT");
if (m_disqualifiedByOrganizer)
return QStringLiteral("DISQ");
}
if (m_missingPunch)
return QStringLiteral("MP ");
if (m_didNotStart)
return QStringLiteral("DNS ");
if (m_didNotFinish)
return QStringLiteral("DNF ");
if (m_overTime)
return QStringLiteral("OVRT");
return QStringLiteral("O.K.");
}

QString RunStatus::toHtmlExportString() const
{
if (m_notCompeting)
return QStringLiteral("NC");
if (m_disqualified) {
if (m_disqualifiedByOrganizer)
return QStringLiteral("DISQ");
if (m_missingPunch)
return QStringLiteral("MP");
if (m_didNotStart)
return QStringLiteral("DNS");
if (m_didNotFinish)
return QStringLiteral("DNF");
if (m_overTime)
return QStringLiteral("OVRT");
if (m_disqualifiedByOrganizer)
return QStringLiteral("DISQ");
}
if (m_missingPunch)
return QStringLiteral("MP");
if (m_didNotStart)
return QStringLiteral("DNS");
if (m_didNotFinish)
return QStringLiteral("DNF");
if (m_overTime)
return QStringLiteral("OVRT");
return QStringLiteral("OK");
}

QString RunStatus::toString() const
{
if (m_notCompeting)
return tr("NC", "Not Competing");
if (m_disqualified) {
if (m_disqualifiedByOrganizer)
return tr("DISQ", "Disqualified");
if (m_missingPunch)
return tr("MP", "Missing Punch");
if (m_didNotStart)
return tr("DNS", "Did Not Start");
if (m_didNotFinish)
return tr("DNF", "Did Not Finish");
if (m_overTime)
return tr("OVRT", "Over Time");
if (m_disqualifiedByOrganizer)
return tr("DISQ", "Disqualified");
}
if (m_missingPunch)
return tr("MP", "Missing Punch");
if (m_didNotStart)
return tr("DNS", "Did Not Start");
if (m_didNotFinish)
return tr("DNF", "Did Not Finish");
if (m_overTime)
return tr("OVRT", "Over Time");
return tr("OK");
}

} // namespace core
} // namespace quickevent
}
7 changes: 2 additions & 5 deletions libquickevent/libquickeventcore/src/runstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <qf/core/utils/treetable.h>
#include <QCoreApplication>

namespace quickevent {
namespace core {
namespace quickevent::core {

class QUICKEVENTCORE_DECL_EXPORT RunStatus
{
Expand All @@ -25,7 +24,6 @@ class QUICKEVENTCORE_DECL_EXPORT RunStatus
QString toHtmlExportString() const;
QString toString() const;

bool idDisqualified() const { return m_disqualified; }
bool isDisqualifiedByOrganizer() const { return m_disqualifiedByOrganizer; }
bool isNotCompeting() const { return m_notCompeting; }
bool isMissingPunch() const { return m_missingPunch; }
Expand All @@ -35,7 +33,6 @@ class QUICKEVENTCORE_DECL_EXPORT RunStatus

static QStringList runsTableColumns();
private:
bool m_disqualified = false;
bool m_disqualifiedByOrganizer = false;
bool m_notCompeting = false;
bool m_missingPunch = false;
Expand All @@ -44,4 +41,4 @@ class QUICKEVENTCORE_DECL_EXPORT RunStatus
bool m_overTime = false;
};

}}
}
11 changes: 6 additions & 5 deletions quickevent/app/quickevent/plugins/Event/qml/DbSchema.qml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ Schema {
//notNull: true
},
Field { name: 'relayId'; type: Int {} },

Field { name: 'corridorTime'; type: DateTime {}
comment: 'DateTime when competitor entered start corridor. (Experimental)'
},
Field { name: 'checkTimeMs'; type: Int {}
comment: 'in miliseconds'
},
Expand All @@ -204,7 +206,7 @@ Schema {
comment: 'in miliseconds'
},
Field { name: 'timeMs'; type: Int {}
comment: 'in miliseconds since event run'
comment: 'in miliseconds'
},

Field { name: 'isRunning'; type: Boolean { }
Expand Down Expand Up @@ -235,8 +237,7 @@ Schema {
Cancelled
*/
Field { name: 'disqualified'; type: Boolean { } // Disqualified
defaultValue: false;
notNull: true
generatedAs: 'disqualifiedByOrganizer OR misPunch OR notStart OR notFinish OR badCheck OR overTime OR notCompeting'
},
Field { name: 'disqualifiedByOrganizer'; type: Boolean { } // Disqualified by Org
defaultValue: false;
Expand Down Expand Up @@ -498,7 +499,7 @@ Schema {
}
]
Component.onCompleted: {
Log.info("DbSchema created");
//Log.info("DbSchema created");
}

}
Loading
Loading