trend analysis supports data from all dates

This commit is contained in:
MaysWind
2024-05-31 11:02:12 +08:00
parent f041e7cb7d
commit c34887240e
3 changed files with 54 additions and 21 deletions
+13 -6
View File
@@ -385,16 +385,23 @@ func (t *TransactionAmountsRequest) GetTransactionAmountsRequestItems() ([]*Tran
// GetNumericYearMonthRange returns numeric start year, start month, end year and end month
func (t *YearMonthRangeRequest) GetNumericYearMonthRange() (int32, int32, int32, int32, error) {
startYear, startMonth, err := utils.ParseNumericYearMonth(t.StartYearMonth)
var startYear, startMonth, endYear, endMonth int32
var err error
if err != nil {
return 0, 0, 0, 0, err
if t.StartYearMonth != "" {
startYear, startMonth, err = utils.ParseNumericYearMonth(t.StartYearMonth)
if err != nil {
return 0, 0, 0, 0, err
}
}
endYear, endMonth, err := utils.ParseNumericYearMonth(t.EndYearMonth)
if t.EndYearMonth != "" {
endYear, endMonth, err = utils.ParseNumericYearMonth(t.EndYearMonth)
if err != nil {
return 0, 0, 0, 0, err
if err != nil {
return 0, 0, 0, 0, err
}
}
return startYear, startMonth, endYear, endMonth, nil