260320_01_EHN: 분석 도중 쓸데없는 코드들 제거
This commit is contained in:
@@ -329,22 +329,20 @@ namespace Keps.WinForms.Forms
|
||||
if (targetRow != null)
|
||||
{
|
||||
int total = targetRow.PollingPlaceCount;
|
||||
int sample = Math.Max(0, targetRow.SampleCount);
|
||||
if (sample > 0)
|
||||
{
|
||||
int interval = total / sample;
|
||||
int start = interval / 2;
|
||||
int endPoint = start + (interval * (sample - 1));
|
||||
int x1 = total - endPoint;
|
||||
int x2 = start - 1;
|
||||
start = (int)Math.Round((x1 + x2) / 2m, 0, MidpointRounding.AwayFromZero);
|
||||
maxRange = total - (interval * (sample - 1)) - start;
|
||||
int sample = targetRow.SampleCount;
|
||||
|
||||
int interval = total / sample;
|
||||
int start = interval / 2;
|
||||
int endPoint = start + (interval * (sample - 1));
|
||||
int x1 = total - endPoint;
|
||||
int x2 = start - 1;
|
||||
start = (int)Math.Round((x1 + x2) / 2m, 0, MidpointRounding.AwayFromZero);
|
||||
maxRange = total - (interval * (sample - 1)) - start;
|
||||
|
||||
if (interval == 0)
|
||||
{
|
||||
maxRange = 0;
|
||||
offsetEnabled = false;
|
||||
}
|
||||
if (interval == 0)
|
||||
{
|
||||
maxRange = 0;
|
||||
offsetEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,35 +82,21 @@ namespace Keps.WinForms.Services
|
||||
using (SqlConnection connection = _connectionFactory.Open())
|
||||
using (SqlCommand command = new SqlCommand(LegacySqlCatalog.RealCandidateNames, connection))
|
||||
{
|
||||
int electionNo;
|
||||
if (int.TryParse(electionName, out electionNo))
|
||||
command.Parameters.AddWithValue("@electionName", electionName);
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
command.Parameters.AddWithValue("@electionName", electionNo);
|
||||
}
|
||||
else
|
||||
{
|
||||
command.Parameters.AddWithValue("@electionName", electionName);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
while (reader.Read())
|
||||
{
|
||||
while (reader.Read())
|
||||
string candNo = Convert.ToString(reader["cand_no"]);
|
||||
string candName = Convert.ToString(reader["cand_name"]);
|
||||
result.Add(new CandidateOption
|
||||
{
|
||||
string candNo = Convert.ToString(reader["cand_no"]);
|
||||
string candName = Convert.ToString(reader["cand_name"]);
|
||||
result.Add(new CandidateOption
|
||||
{
|
||||
Key = "cand_ratio_" + candNo,
|
||||
DisplayName = candName + "(" + candNo + ")"
|
||||
});
|
||||
}
|
||||
Key = "cand_ratio_" + candNo,
|
||||
DisplayName = candName + "(" + candNo + ")"
|
||||
});
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
result.Add(new CandidateOption { Key = "투표인수", DisplayName = "투표인수" });
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Keps.WinForms.Services
|
||||
string sortKey,
|
||||
string sortDisplayName,
|
||||
bool descending,
|
||||
List<ClusterSummaryRow> allocationRows,
|
||||
List<ClusterSummaryRow> workingRows,
|
||||
int signedOffset,
|
||||
string offsetDescription,
|
||||
bool isAutoAllocation)
|
||||
@@ -190,23 +190,23 @@ namespace Keps.WinForms.Services
|
||||
List<ExtractionRow> populationRows = new List<ExtractionRow>();
|
||||
List<PollingPlaceRecord> extractedSourceRows = new List<PollingPlaceRecord>();
|
||||
|
||||
foreach (ClusterSummaryRow allocation in allocationRows.OrderBy(x => x.ClusterNo))
|
||||
foreach (ClusterSummaryRow workingRow in workingRows.OrderBy(x => x.ClusterNo))
|
||||
{
|
||||
List<PollingPlaceRecord> clusterRows = allRows.Where(x => x.ClusterValue == allocation.ClusterNo).ToList();
|
||||
List<PollingPlaceRecord> clusterRows = allRows.Where(x => x.ClusterValue == workingRow.ClusterNo).ToList();
|
||||
clusterRows = descending
|
||||
? clusterRows.OrderByDescending(x => x.GetSortValue(sortKey)).ThenBy(x => x.EupMyeonDong).ThenBy(x => GetPollingPlaceSortValue(x.PollingPlaceNo)).ThenBy(x => x.PollingPlaceNo).ToList()
|
||||
: clusterRows.OrderBy(x => x.GetSortValue(sortKey)).ThenBy(x => x.EupMyeonDong).ThenBy(x => GetPollingPlaceSortValue(x.PollingPlaceNo)).ThenBy(x => x.PollingPlaceNo).ToList();
|
||||
|
||||
int interval;
|
||||
int startPosition;
|
||||
List<int> extractIds = SelectLegacyExtractIds(clusterRows.Count, allocation.SampleCount, signedOffset, out interval, out startPosition);
|
||||
List<int> extractIds = SelectLegacyExtractIds(clusterRows.Count, workingRow.SampleCount, signedOffset, out interval, out startPosition);
|
||||
HashSet<int> selectedPositions = new HashSet<int>(extractIds);
|
||||
|
||||
for (int i = 0; i < clusterRows.Count; i++)
|
||||
{
|
||||
int originalOrder = i + 1;
|
||||
PollingPlaceRecord row = clusterRows[i];
|
||||
populationRows.Add(CreateExtractionRow(row, allocation.ClusterNo, originalOrder, originalOrder, interval, startPosition, offsetDescription, row.GetSortValue(sortKey), selectedPositions.Contains(originalOrder), selectedPositions.Contains(originalOrder)));
|
||||
populationRows.Add(CreateExtractionRow(row, workingRow.ClusterNo, originalOrder, originalOrder, interval, startPosition, offsetDescription, row.GetSortValue(sortKey), selectedPositions.Contains(originalOrder), selectedPositions.Contains(originalOrder)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < extractIds.Count; i++)
|
||||
@@ -219,7 +219,7 @@ namespace Keps.WinForms.Services
|
||||
|
||||
PollingPlaceRecord row = clusterRows[extractId - 1];
|
||||
extractedSourceRows.Add(row);
|
||||
extractedRows.Add(CreateExtractionRow(row, allocation.ClusterNo, i + 1, extractId, interval, startPosition, offsetDescription, row.GetSortValue(sortKey), true, true));
|
||||
extractedRows.Add(CreateExtractionRow(row, workingRow.ClusterNo, i + 1, extractId, interval, startPosition, offsetDescription, row.GetSortValue(sortKey), true, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,9 +235,9 @@ namespace Keps.WinForms.Services
|
||||
ExtractedRows = extractedRows.OrderBy(x => x.ClusterNo).ThenBy(x => x.ClusterOrder).ToList(),
|
||||
PopulationRows = populationRows.OrderBy(x => x.ClusterNo).ThenBy(x => x.OriginalOrder).ToList(),
|
||||
AdjustmentRows = BuildAdjustmentRows(extractedRows),
|
||||
VerificationRows = BuildVerificationRows(allRows, extractedSourceRows, allocationRows, candidateMeta),
|
||||
VerificationRows = BuildVerificationRows(allRows, extractedSourceRows, workingRows, candidateMeta),
|
||||
ClusterMax = clusterMax,
|
||||
TotalSampleCount = allocationRows.Sum(x => x.SampleCount),
|
||||
TotalSampleCount = workingRows.Sum(x => x.SampleCount),
|
||||
IsAutoAllocation = isAutoAllocation,
|
||||
SortDisplayName = sortDisplayName,
|
||||
SortDescending = descending,
|
||||
@@ -308,15 +308,7 @@ namespace Keps.WinForms.Services
|
||||
using (SqlConnection connection = _connectionFactory.Open())
|
||||
using (SqlCommand command = new SqlCommand(LegacySqlCatalog.RealCandidateNames, connection))
|
||||
{
|
||||
int electionNo;
|
||||
if (int.TryParse(electionName, out electionNo))
|
||||
{
|
||||
command.Parameters.AddWithValue("@electionName", electionNo);
|
||||
}
|
||||
else
|
||||
{
|
||||
command.Parameters.AddWithValue("@electionName", electionName);
|
||||
}
|
||||
command.Parameters.AddWithValue("@electionName", electionName);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user