code refactor
This commit is contained in:
@@ -98,6 +98,12 @@ func (c *feideeMymoneyTransactionDataCsvImporter) ParseImportedData(ctx core.Con
|
||||
|
||||
for i := 1; i < len(allLines); i++ {
|
||||
items := allLines[i]
|
||||
|
||||
if len(items) < len(headerLineItems) {
|
||||
log.Errorf(ctx, "[feidee_mymoney_transaction_data_csv_file_importer.ParseImportedData] cannot parse row \"index:%d\" for user \"uid:%d\", because may missing some columns (column count %d in data row is less than header column count %d)", i, user.Uid, len(items), len(headerLineItems))
|
||||
return nil, nil, nil, nil, nil, nil, errs.ErrFewerFieldsInDataRowThanInHeaderRow
|
||||
}
|
||||
|
||||
data, relatedId := c.parseTransactionData(items,
|
||||
timeColumnIdx,
|
||||
timeColumnExists,
|
||||
@@ -119,11 +125,6 @@ func (c *feideeMymoneyTransactionDataCsvImporter) ParseImportedData(ctx core.Con
|
||||
relatedIdColumnExists,
|
||||
)
|
||||
|
||||
if len(items) < len(headerLineItems) {
|
||||
log.Errorf(ctx, "[feidee_mymoney_transaction_data_csv_file_importer.ParseImportedData] cannot parse row \"index:%d\" for user \"uid:%d\", because may missing some columns (column count %d in data row is less than header column count %d)", i, user.Uid, len(items), len(headerLineItems))
|
||||
return nil, nil, nil, nil, nil, nil, errs.ErrFewerFieldsInDataRowThanInHeaderRow
|
||||
}
|
||||
|
||||
transactionType := data[datatable.DATA_TABLE_TRANSACTION_TYPE]
|
||||
|
||||
if transactionType == "余额变更" || transactionType == "收入" || transactionType == "支出" {
|
||||
|
||||
Reference in New Issue
Block a user