Sfoglia il codice sorgente

Fixed Bug in Database::getTotals()

When getting totals from the database with previous experience included, the sum would be stored in the wrong map, not counting current logbook experience
Felix Turowsky 1 anno fa
parent
commit
929a2c54d0

+ 2 - 2
src/database/database.cpp

@@ -564,10 +564,10 @@ const RowData_T Database::getTotals(bool includePreviousExperience)
         int entryValue = entry_data.value(it.key()).toInt();
 
         const QVariant sum = prevXpValue + entryValue;
-        it.value() = sum;
+        entry_data.insert(it.key(), sum);
     }
 
-    return prev_exp_data;
+    return entry_data;
 }
 
 QList<int> Database::getForeignKeyConstraints(int foreign_row_id, OPL::DbTable table)

+ 1 - 0
src/gui/widgets/totalswidget.cpp

@@ -92,6 +92,7 @@ void TotalsWidget::fillTotals(const WidgetType widgetType)
         break;
     case PreviousExperienceWidget:
         time_data = DB->getRowData(OPL::DbTable::PreviousExperience, ROW_ID);
+        break;
     }
 
     // fill the line edits with the data obtained

+ 12 - 0
src/gui/widgets/totalswidget.h

@@ -28,6 +28,18 @@ namespace Ui {
 class TotalsWidget;
 }
 
+/*!
+ * \brief The TotalsWidget is used to display or edit total time values.
+ * \details This widget has two different purposes.
+ * <ul>
+ * <li> It displays the cumulative total time in the logbook </li>
+ * <li> It is used to enter and edit the total time accumulated in previous logbooks </li>
+ * </ul>
+ *
+ * In its total time form, the Widget functions purely as a display widget, whereas when used
+ * for previous experience, its fields are editable.
+ *
+ */
 class TotalsWidget : public QWidget
 {
     Q_OBJECT