Skip to content

Commit dcc8f26

Browse files
committed
Clean up
1 parent 4b0778e commit dcc8f26

File tree

7 files changed

+15
-147
lines changed

7 files changed

+15
-147
lines changed

src/PivotSharp/PivotConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public class PivotConfig
1616

1717
public IList<AggregatorDef> Aggregators { get; set; } = [];
1818

19+
public bool IncludeZeroValues { get; set; } = false;
20+
1921
public ConfigurationErrorHandlingMode ErrorMode { get; set; }
2022
= ConfigurationErrorHandlingMode.Ignore;
2123

src/PivotSharp/PivotSharp.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
<Nullable>enable</Nullable>
1414
<ImplicitUsings>disable</ImplicitUsings>
1515
</PropertyGroup>
16-
<ItemGroup>
17-
<EmbeddedResource Include="Templates\Table.cshtml">
18-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
19-
</EmbeddedResource>
20-
</ItemGroup>
2116
<ItemGroup>
2217
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
2318
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />

src/PivotSharp/PivotSqlString.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public PivotSqlString(PivotConfig config) {
4545
/// select {groupingColumns},{Aggregations} from {tableName} where {FilterColumns} group by {GroupingColumns}
4646
/// </summary>
4747
public override string ToString() =>
48-
$"select {SelectList} from {tableName} "
49-
+ $" {WhereClause}"
50-
+ $" {GroupByClause}";
48+
string.Join(" ", [$"select {SelectList} from {tableName}", $"{WhereClause}", $"{GroupByClause}"]).Replace(" ", " ");
5149

5250
}

src/PivotSharp/PivotTable.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,21 @@ namespace PivotSharp;
7373
/// </remarks>
7474
public class PivotTable
7575
{
76+
/// <summary>
77+
/// Used to produce flattened row and column keys. The Delimeter needs to be something
78+
/// that won't appear in any of the header values.
79+
/// </summary>
7680
public static string KeyDelimiter { get; set; } = "/~/";
7781

7882
private readonly IPivotDataSourceConnector connector;
7983

80-
// Need to be able to group these.
81-
// sort by field1 then field2, etc.
82-
8384
// PivotFieldList : List<PivotField>
8485
public RowOrColumns Rows { get; private set; }
8586
public RowOrColumns Cols { get; private set; }
8687

8788
// PivotCell
8889
public PivotCell GrandTotal { get; private set; }
8990

90-
// AggregatorDef -> Aggregator?
91-
// Cells
9291
public PivotBody Cells { get; private set; }
9392

9493
public PivotConfig Config => connector.Config;

src/PivotSharp/Templates/Table.cshtml

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/PivotSharp/Templates/TableViewModel.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/PivotSharp.Tests/03-Multi_Layer_Test.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ public void Init() {
5252
[Test]
5353
public void Can_Generate_Headers() {
5454
Assert.That(pivot.Cols.Count(), Is.EqualTo(3));
55-
Assert.That(pivot.Cols[0].FlattenedKey, Is.EqualTo("dotted,outside"));
56-
Assert.That(pivot.Cols[1].FlattenedKey, Is.EqualTo("dashed,outside"));
57-
Assert.That(pivot.Cols[2].FlattenedKey, Is.EqualTo("dotted,inside"));
55+
Assert.That(pivot.Cols[0].FlattenedKey, Is.EqualTo("dotted/~/outside"));
56+
Assert.That(pivot.Cols[1].FlattenedKey, Is.EqualTo("dashed/~/outside"));
57+
Assert.That(pivot.Cols[2].FlattenedKey, Is.EqualTo("dotted/~/inside"));
5858

5959
Assert.That(pivot.Rows.Count(), Is.EqualTo(2));
60-
Assert.That(pivot.Rows[0].FlattenedKey, Is.EqualTo("blue,circle"));
61-
Assert.That(pivot.Rows[1].FlattenedKey, Is.EqualTo("red,triangle"));
60+
Assert.That(pivot.Rows[0].FlattenedKey, Is.EqualTo("blue/~/circle"));
61+
Assert.That(pivot.Rows[1].FlattenedKey, Is.EqualTo("red/~/triangle"));
6262
}
6363

6464
[Test]
@@ -70,9 +70,9 @@ public void Can_Generate_Elements() {
7070

7171
[Test]
7272
public void Can_Generate_Counts() {
73-
Assert.That(pivot.Cells["blue,circle"]["dotted,outside"][0].Value, Is.EqualTo(2));
74-
Assert.That(pivot.Cells["blue,circle"]["dashed,outside"][0].Value, Is.EqualTo(1));
75-
Assert.That(pivot.Cells["red,triangle"]["dotted,inside"][0].Value, Is.EqualTo(1));
73+
Assert.That(pivot.Cells["blue/~/circle"]["dotted/~/outside"][0].Value, Is.EqualTo(2));
74+
Assert.That(pivot.Cells["blue/~/circle"]["dashed/~/outside"][0].Value, Is.EqualTo(1));
75+
Assert.That(pivot.Cells["red/~/triangle"]["dotted/~/inside"][0].Value, Is.EqualTo(1));
7676

7777
Assert.That(pivot.GrandTotal[0].Value, Is.EqualTo(4));
7878
}

0 commit comments

Comments
 (0)