Skip to content

Commit

Permalink
Fix equality handling of CatalogItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo3zehn committed Mar 16, 2024
1 parent 71f7491 commit 999620e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v2.0.0-beta.26 - 2024-03-16
- Fix equality handling of `CatalogItem`.

### Bugs fixed:
- Fixed wrong Docker base image.

## v2.0.0-beta.25 - 2024-03-15

### Bugs fixed:
Expand Down
10 changes: 5 additions & 5 deletions src/Nexus/Extensions/Writers/Csv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ public async Task OpenAsync(
_unixStart = (fileBegin - _unixEpoch).TotalSeconds;
_excelStart = fileBegin.ToOADate();

foreach (var catalogItemGroup in catalogItems.GroupBy(catalogItem => catalogItem.Catalog))
foreach (var catalogItemGroup in catalogItems.GroupBy(catalogItem => catalogItem.Catalog.Id))
{
cancellationToken.ThrowIfCancellationRequested();

var catalog = catalogItemGroup.Key;
var physicalId = catalog.Id.TrimStart('/').Replace('/', '_');
var catalogId = catalogItemGroup.Key;
var physicalId = catalogId.TrimStart('/').Replace('/', '_');
var root = Context.ResourceLocator.ToPath();

/* metadata */
Expand Down Expand Up @@ -140,7 +140,7 @@ public async Task OpenAsync(
var schema = new Schema(
PrimaryKey: timestampField.Name,
Fields: fields,
Properties: catalog.Properties
Properties: catalogItemGroup.First().Catalog.Properties
);

resource = new CsvResource(
Expand Down Expand Up @@ -175,7 +175,7 @@ public async Task OpenAsync(
stringBuilder.Append($"# sample_period: {samplePeriod.ToUnitString()}");
AppendWindowsNewLine(stringBuilder);

stringBuilder.Append($"# catalog_id: {catalog.Id}");
stringBuilder.Append($"# catalog_id: {catalogId}");
AppendWindowsNewLine(stringBuilder);

/* field name */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ internal bool TryFind(ResourcePathParseResult parseResult, [NotNullWhen(true)] o
return false;

catalogItem = new CatalogItem(
this,
resource,
this with { Resources = default },
resource with { Representations = default },
representation,
parameters);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ public void CanFindCatalogItem()
var catalog = new ResourceCatalog(id: "/A/B/C", resources: new List<Resource>() { resource });

var catalogItem = new CatalogItem(
catalog,
resource,
catalog with { Resources = default },
resource with { Representations = default },
representation,
Parameters: default);

Expand All @@ -279,8 +279,8 @@ public void CanTryFindCatalogItem()
var catalog = new ResourceCatalog(id: "/A/B/C", resources: new List<Resource>() { resource });

var catalogItem = new CatalogItem(
catalog,
resource,
catalog with { Resources = default },
resource with { Representations = default },
representation,
Parameters: default);

Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.0.0",
"suffix": "beta.25"
"suffix": "beta.26"
}

0 comments on commit 999620e

Please sign in to comment.