Represents a collection of completed surveys identified by a bank account. It provides extended functionality built upon a map-like structure for efficient access and modification of surveys.
More...
#include <CompletedSurvey.h>
|
| CompletedSurveys (std::map< banking::BankAccount, CompletedSurvey > surveys) |
| Constructs a collection of completed surveys associated with bank accounts.
|
|
std::optional< CompletedSurvey > | lookUpSurvey (const banking::BankAccount &ba) const noexcept |
| Looks up a completed survey for a given bank account. This query provides information regarding the survey associated with the reconciled state of the bank account, aiding in identifying its distribution and budgeting details.
|
|
std::optional< CompletedSurvey > | lookUpSurvey (const banking::BankName &bn, const accounting::AccountNumber &an) const noexcept |
| Searches for a completed survey linked to a specific bank and account. This is used to retrieve a previously reconciled survey for a bank account, enabling review or further processing of the completed survey data.
|
|
bool | upsert (CompletedSurvey survey) |
| Inserts or updates a completed survey for a specific bank account, ensuring distribution identifiers are unique within the context of all existing surveys.
|
|
Represents a collection of completed surveys identified by a bank account. It provides extended functionality built upon a map-like structure for efficient access and modification of surveys.
◆ CompletedSurveys()
Constructs a collection of completed surveys associated with bank accounts.
- Exceptions
-
SurveyError | Thrown when an indexed bank account does not match the surveyed bank account. |
- Parameters
-
surveys | A collection mapping bank accounts to their completed surveys. |
◆ lookUpSurvey() [1/2]
Looks up a completed survey for a given bank account. This query provides information regarding the survey associated with the reconciled state of the bank account, aiding in identifying its distribution and budgeting details.
- Parameters
-
ba | The bank account for which the completed survey is being looked up. |
- Returns
- An optional object containing the completed survey for the given bank account, or an empty result if no associated survey is found.
◆ lookUpSurvey() [2/2]
Searches for a completed survey linked to a specific bank and account. This is used to retrieve a previously reconciled survey for a bank account, enabling review or further processing of the completed survey data.
- Parameters
-
bn | The name of the bank associated with the survey being searched. |
an | The number of the account associated with the survey being searched. |
- Returns
- An optional containing the completed survey if a match is found, or an empty result if no matching survey exists.
◆ upsert()
Inserts or updates a completed survey for a specific bank account, ensuring distribution identifiers are unique within the context of all existing surveys.
- Exceptions
-
SurveyError | When the provided survey contains a distribution identifier that overlaps with an existing survey’s identifiers for a different bank account. |
- Parameters
-
survey | The completed survey to insert or update. This survey includes reconciled data, distributions, and other associated information. |
- Postcondition
- If the bank account associated with the provided survey does not exist within the system, the survey is added as a new entry. If the bank account does exist, the existing survey is replaced with the provided survey.
- Returns
- Returns true if a new survey is inserted, and false if an existing survey is replaced.