Can guess amount columns with numbers in header
This commit is contained in:
parent
656f565152
commit
f1abb03ac9
@ -47,19 +47,21 @@ public class GuessReader : IReader
|
||||
}
|
||||
if (currentIndex > productColumnIndex)
|
||||
{
|
||||
if (IsAmountColumn(range.Columns[currentIndex++]))
|
||||
if (IsAmountColumn(range.Columns[currentIndex]))
|
||||
{
|
||||
amountColumnIndex = currentIndex - 1;
|
||||
amountColumnIndex = currentIndex;
|
||||
break;
|
||||
}
|
||||
else currentIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsAmountColumn(range.Columns[currentIndex--]))
|
||||
if (IsAmountColumn(range.Columns[currentIndex]))
|
||||
{
|
||||
amountColumnIndex = currentIndex + 1;
|
||||
amountColumnIndex = currentIndex;
|
||||
break;
|
||||
}
|
||||
else currentIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,6 +113,7 @@ public class GuessReader : IReader
|
||||
{
|
||||
int successCounter = 0;
|
||||
var cells = column.Value2;
|
||||
double maxValue = 30000;
|
||||
|
||||
if (cells == null)
|
||||
{
|
||||
@ -132,18 +135,23 @@ public class GuessReader : IReader
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value > 30000)
|
||||
if (value > maxValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (++successCounter > 3)
|
||||
if (column.Rows.Count == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (++successCounter > 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return successCounter > 0;
|
||||
return successCounter > 1;
|
||||
}
|
||||
|
||||
private Dictionary<Product, double> GetDictionaryFromColumns(Range productColumn, Range amountColumn)
|
||||
|
Loading…
Reference in New Issue
Block a user