Skip to content

Commit

Permalink
Merge pull request #818 from matty0ung/usability
Browse files Browse the repository at this point in the history
Fixes for a couple of asserts
  • Loading branch information
matty0ung authored Sep 2, 2024
2 parents 8919603 + 421a1e7 commit 226a9b3
Show file tree
Hide file tree
Showing 28 changed files with 149 additions and 505 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------------------------------------------------
# .github/workflows/mac.yml is part of Brewtarget, and is copyright the following authors 2021-2023:
# .github/workflows/mac.yml is part of Brewtarget, and is copyright the following authors 2021-2024:
# • Artem Martynov <[email protected]>
# • Mattias Måhl <[email protected]>
# • Matt Young <[email protected]>
Expand Down
3 changes: 2 additions & 1 deletion src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,10 +2241,11 @@ void MainWindow::updateRecipeBoilSize() {
return;
}

// See comments in model/Boil.h for why boil size is, technically, optional
auto boil = this->m_recipeObs->nonOptBoil();
this->doOrRedoUpdate(*boil,
TYPE_INFO(Boil, preBoilSize_l),
lineEdit_boilSize->getNonOptCanonicalQty(),
lineEdit_boilSize->getOptCanonicalQty(),
tr("Change Boil Size"));
return;
}
Expand Down
18 changes: 17 additions & 1 deletion src/model/Boil.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ AddPropertyName(boilSteps )
*
* Additionally, there is a short-term benefit, which is that we can share a lot of the logic between
* MashStep and BoilStep, which saves us duplicating code.
*
* Our \c Boil class maps closely to a BeerJSON "boil procedure", with the exception that, in BeerJSON "a
* boil procedure with no steps is the same as a standard single step boil."
*/
class Boil : public NamedEntity,
public FolderBase<Boil>,
Expand Down Expand Up @@ -109,8 +112,21 @@ class Boil : public NamedEntity,
Q_PROPERTY(QString folder READ folder WRITE setFolder)
Q_PROPERTY(QString description READ description WRITE setDescription )
Q_PROPERTY(QString notes READ notes WRITE setNotes )

/**
* \brief This is optional because it's optional in BeerJSON. The equivalent field in BeerXML (BOIL_SIZE on RECIPE)
* is a required field.
*
* Note however, that Recipe::batchSize_l is a required field in both BeerJSON and BeerXML, so callers should
* fall back to that as a "better than nothing" value when this one is \c std::nullopt.
*/
Q_PROPERTY(std::optional<double> preBoilSize_l READ preBoilSize_l WRITE setPreBoilSize_l )
//! \brief The total time to boil the wort. Hopefully equal to the sum of the times of all the steps
/**
* \brief The total time to boil the wort. Hopefully equal to the sum of the times of all the steps.
* (TODO: We should probably add some validation about this, though it's a bit complicated as not all steps
* necessarily have times, but the length of the boil should be no shorter than the sum of the step
* times, for sure.)
*/
Q_PROPERTY(double boilTime_mins READ boilTime_mins WRITE setBoilTime_mins )
/**
* \brief The individual boil steps. (See \c StepOwnerBase for getter/setter implementation.)
Expand Down
Loading

0 comments on commit 226a9b3

Please sign in to comment.