diff --git a/src/KPI Generator/KPI Generator.csproj b/src/KPI Generator/KPI Generator.csproj index 42602aa66e3f6534fed756771aa03e0e0a7d87cf..1aed9c440b01aeb6be846e1b0a697c971d9b1d60 100644 --- a/src/KPI Generator/KPI Generator.csproj +++ b/src/KPI Generator/KPI Generator.csproj @@ -13,7 +13,7 @@ <PropertyGroup> <Authors>RWTH Aachen University</Authors> <Company>IT Center, RWTH Aachen University</Company> - <Copyright>©2022 IT Center, RWTH Aachen University</Copyright> + <Copyright>©2023 IT Center, RWTH Aachen University</Copyright> <Description>KPI Generator is a part of the Coscine group.</Description> </PropertyGroup> diff --git a/src/KPI Generator/Reportings/Project/ProjectReporting.cs b/src/KPI Generator/Reportings/Project/ProjectReporting.cs index 9e539f55c4c2d7bd2b3e8765edae28f92e6b7a0b..349bd35874816f3cbc65179665edf263866f345a 100644 --- a/src/KPI Generator/Reportings/Project/ProjectReporting.cs +++ b/src/KPI Generator/Reportings/Project/ProjectReporting.cs @@ -85,23 +85,15 @@ public class ProjectReporting : Reporting<ProjectReportingOptions> var organizationsFromProjects = GetTopLevelOrganizationsFromEntries(returnObjects.SelectMany(ro => ro.Organizations)); foreach (var entry in organizationsFromProjects) { - var organization = Organizations.Find(o => o.RorUrl.Equals(entry.RorUrl)); - if (organization is null) - { - organization = _otherOrganization; - Console.WriteLine($" WARNING!: Organization \"{entry.RorUrl}\" could not be correctly identified. Will use \"{_otherOrganization.RorUrl}\"."); - _logger.LogWarning("Organization {ror} could not be correctly identified.", entry.RorUrl); - } - var returnObjectsForOrganization = returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Contains(entry.RorUrl))).ToList(); var reportingFile = new ReportingFileObject { - Path = GetReportingPathOrganization(organization.RorUrl, ReportingFileName), + Path = GetReportingPathOrganization(entry.RorUrl, ReportingFileName), Content = ConvertStringContentsToStream(JsonConvert.SerializeObject(returnObjectsForOrganization, Formatting.Indented)) }; reportingFilesPerOrganization.Add(reportingFile); - Console.WriteLine($" - {GetType().Name}: \"{GetReportingPathOrganization(organization.RorUrl, ReportingFileName)}\" generated successfully"); + Console.WriteLine($" - {GetType().Name}: \"{GetReportingPathOrganization(entry.RorUrl, ReportingFileName)}\" generated successfully"); _logger.LogInformation("{Name}: Generated successfully {ReportingFile}.", GetType().Name, reportingFile); } diff --git a/src/KPI Generator/Reportings/Resource/ResourceReporting.cs b/src/KPI Generator/Reportings/Resource/ResourceReporting.cs index 966a3ec228012ca9882e066e3fcca3675043243e..da2ba40545e13996bf7bc1c0107c6b14fc43dd16 100644 --- a/src/KPI Generator/Reportings/Resource/ResourceReporting.cs +++ b/src/KPI Generator/Reportings/Resource/ResourceReporting.cs @@ -84,22 +84,15 @@ public class ResourceReporting : Reporting<ResourceReportingOptions> var organizationsFromResources = GetTopLevelOrganizationsFromEntries(returnObjects.SelectMany(ro => ro.Organizations)); foreach (var entry in organizationsFromResources) { - var organization = Organizations.Find(o => o.RorUrl.Equals(entry.RorUrl)); - if (organization is null) - { - organization = _otherOrganization; - Console.WriteLine($" WARNING!: Organization \"{entry.RorUrl}\" could not be correctly identified. Will use \"{_otherOrganization.RorUrl}\"."); - _logger.LogWarning("Organization {ror} could not be correctly identified.", entry.RorUrl); - } var returnObjectsForOrganization = returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Equals(entry.RorUrl))).ToList(); var reportingFile = new ReportingFileObject { - Path = GetReportingPathOrganization(organization.RorUrl, ReportingFileName), + Path = GetReportingPathOrganization(entry.RorUrl, ReportingFileName), Content = ConvertStringContentsToStream(JsonConvert.SerializeObject(returnObjectsForOrganization, Formatting.Indented)) }; reportingFilesPerOrganization.Add(reportingFile); - Console.WriteLine($" - {GetType().Name}: \"{GetReportingPathOrganization(organization.RorUrl, ReportingFileName)}\" generated successfully"); + Console.WriteLine($" - {GetType().Name}: \"{GetReportingPathOrganization(entry.RorUrl, ReportingFileName)}\" generated successfully"); _logger.LogInformation("{Name}: Generated successfully {ReportingFile}.", GetType().Name, reportingFile); } return reportingFilesPerOrganization; diff --git a/src/KPI Generator/Reportings/System/MaintenanceReturnObject.cs b/src/KPI Generator/Reportings/System/MaintenanceReturnObject.cs index 2d71f8c017f342193ab5232f5fb8c282446843b3..7af2780672e51fd3ff6d8107a8c763a3f9cf1f6a 100644 --- a/src/KPI Generator/Reportings/System/MaintenanceReturnObject.cs +++ b/src/KPI Generator/Reportings/System/MaintenanceReturnObject.cs @@ -15,8 +15,8 @@ public class MaintenanceBannerObject [JsonProperty("status")] public string Status { get; set; } = null!; [JsonProperty("start_at")] - public DateTime StartAt { get; set; } + public DateTime? StartAt { get; set; } = null!; [JsonProperty("end_at")] - public DateTime EndAt { get; set; } + public DateTime? EndAt { get; set; } = null!; } diff --git a/src/KPI Generator/Reportings/User/UserReporting.cs b/src/KPI Generator/Reportings/User/UserReporting.cs index 237e84cefa0dccbfe7e38a1b6d8e757b2b42e243..c06d7f6d3ef729ab11c5415a0f8d58327b742ace 100644 --- a/src/KPI Generator/Reportings/User/UserReporting.cs +++ b/src/KPI Generator/Reportings/User/UserReporting.cs @@ -230,12 +230,12 @@ public class UserReporting : Reporting<UserReportingOptions> private List<Organization> CleanUpOther(List<Organization> affiliations) { // Special case until `https://ror.org/%20https://ror.org/` is moved to `https://ror.org/_other` - if (affiliations.Any(o => o.RorUrl.Equals("https://ror.org/%20https://ror.org/"))) + if (affiliations.Any(o => o.RorUrl.Equals("https://ror.org/%20https://ror.org/") || o.RorUrl.Equals("https://ror.org/"))) { var cleanedUpAffiliations = affiliations; foreach (var entry in cleanedUpAffiliations) { - if (entry.RorUrl.Equals("https://ror.org/%20https://ror.org/")) + if (entry.RorUrl.Equals("https://ror.org/%20https://ror.org/") || entry.RorUrl.Equals("https://ror.org/")) { cleanedUpAffiliations[cleanedUpAffiliations.IndexOf(entry)] = new() {