Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded PcAxis.Sql nuget to 1.2.5 #263

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

}

private Item? CreateMenu(string language, ItemSelection itmSel)

Check warning on line 74 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)

Check warning on line 74 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)
{
var cnmmOptions = _cnmmConfigurationService.GetConfiguration();

Expand All @@ -86,12 +86,12 @@
m.RootSelection = itmSel;
m.AlterItemBeforeStorage = item =>
{
if (item is Url)

Check warning on line 89 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Replace this type-check-and-cast sequence to use pattern matching. (https://rules.sonarsource.com/csharp/RSPEC-3247)

Check warning on line 89 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Replace this type-check-and-cast sequence to use pattern matching. (https://rules.sonarsource.com/csharp/RSPEC-3247)

Check warning on line 89 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Replace this type-check-and-cast sequence to use pattern matching. (https://rules.sonarsource.com/csharp/RSPEC-3247)
{
Url url = (Url)item;

Check warning on line 91 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Remove the unused local variable 'url'. (https://rules.sonarsource.com/csharp/RSPEC-1481)

Check warning on line 91 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Remove the unused local variable 'url'. (https://rules.sonarsource.com/csharp/RSPEC-1481)
}

if (item is TableLink)

Check warning on line 94 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Replace this type-check-and-cast sequence to use pattern matching. (https://rules.sonarsource.com/csharp/RSPEC-3247)

Check warning on line 94 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Replace this type-check-and-cast sequence to use pattern matching. (https://rules.sonarsource.com/csharp/RSPEC-3247)

Check warning on line 94 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Replace this type-check-and-cast sequence to use pattern matching. (https://rules.sonarsource.com/csharp/RSPEC-3247)
{
TableLink tbl = (TableLink)item;

Expand All @@ -116,7 +116,7 @@
item.SortCode = item.Text;
}
};
m.Restriction = item => { return true; }; // TODO: Will show all tables! Even though they are not published...

Check warning on line 119 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 119 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 119 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
});
retMenu.RootItem.Sort();

Expand Down Expand Up @@ -153,7 +153,7 @@
return selectionExists;
}

private string CreateTableTitleWithInterval(TableLink child)

Check warning on line 156 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Make 'CreateTableTitleWithInterval' a static method. (https://rules.sonarsource.com/csharp/RSPEC-2325)

Check warning on line 156 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

Make 'CreateTableTitleWithInterval' a static method. (https://rules.sonarsource.com/csharp/RSPEC-2325)
{
StringBuilder sb = new StringBuilder();

Expand All @@ -172,7 +172,7 @@
{
return sb.ToString();
}
if (child.Text.EndsWith("-"))//Title ends with a dash, only endtime should be added

Check warning on line 175 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

"EndsWith" overloads that take a "char" should be used (https://rules.sonarsource.com/csharp/RSPEC-6610)

Check warning on line 175 in PxWeb/Code/Api2/DataSource/Cnmm/CnmmDataSource.cs

View workflow job for this annotation

GitHub Actions / build

"EndsWith" overloads that take a "char" should be used (https://rules.sonarsource.com/csharp/RSPEC-6610)
{
sb.Append(child.EndTime);
return sb.ToString();
Expand Down Expand Up @@ -213,16 +213,15 @@
private Codelist? GetGrouping(string id, string language)
{
Codelist? codelist = null;
var cnmmOptions = _cnmmConfigurationService.GetConfiguration();

if (id.StartsWith("agg_", System.StringComparison.InvariantCultureIgnoreCase))
{
// Remove leading "agg_" from id
id = id.Substring(4);
}

PCAxis.Sql.Repositories.GroupingRepository repo = new PCAxis.Sql.Repositories.GroupingRepository(cnmmOptions.DatabaseID);
PCAxis.Sql.Models.Grouping grouping = repo.GetGrouping(id, language);
var util = new PCAxis.Sql.ApiUtils.ApiUtil();
PCAxis.Sql.Models.Grouping grouping = util.GetGrouping(id, language);

if (grouping != null)
{
Expand All @@ -235,16 +234,15 @@
private Codelist? GetValueset(string id, string language)
{
Codelist? codelist = null;
var cnmmOptions = _cnmmConfigurationService.GetConfiguration();

if (id.StartsWith("vs_", System.StringComparison.InvariantCultureIgnoreCase))
{
// Remove leading "vs_" from id
id = id.Substring(3);
}

PCAxis.Sql.Repositories.ValueSetRepository repo = new PCAxis.Sql.Repositories.ValueSetRepository(cnmmOptions.DatabaseID);
PCAxis.Sql.Models.ValueSet valueset = repo.GetValueSet(id, language);
var util = new PCAxis.Sql.ApiUtils.ApiUtil();
PCAxis.Sql.Models.ValueSet valueset = util.GetValueSet(id, language);

if (valueset != null)
{
Expand Down
2 changes: 1 addition & 1 deletion PxWeb/PxWeb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="PCAxis.Menu.ConfigDatamodelMenu" Version="1.0.8" />
<PackageReference Include="PCAxis.Serializers" Version="1.3.1" />
<PackageReference Include="PcAxis.Sql" Version="1.2.4" />
<PackageReference Include="PcAxis.Sql" Version="1.2.5" />
<PackageReference Include="PxWeb.Api2.Server" Version="2.0.0-beta.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" />
Expand Down
Loading