Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • coscine/backend/scripts/kpi-generator
1 result
Select Git revision
Loading items
Show changes
Commits on Source (2)
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<AssemblyName>Coscine.KpiGenerator</AssemblyName> <AssemblyName>Coscine.KpiGenerator</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>0.1.16</Version> <Version>0.1.17</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
......
using Coscine.Database.DataModel; using Coscine.Database.Models;
using Coscine.Database.Models;
using Coscine.Database.ReturnObjects; using Coscine.Database.ReturnObjects;
using Coscine.KpiGenerator.Utils; using Coscine.KpiGenerator.Utils;
using Coscine.Metadata; using Coscine.Metadata;
using LinqToDB.Common;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;
using System.Collections.Generic;
using VDS.RDF.Query; using VDS.RDF.Query;
using static KPIGenerator.Utils.CommandLineOptions; using static KPIGenerator.Utils.CommandLineOptions;
...@@ -87,7 +86,18 @@ public class UserReporting : Reporting<UserReportingOptions> ...@@ -87,7 +86,18 @@ public class UserReporting : Reporting<UserReportingOptions>
var organizationsFromUsers = GetTopLevelOrganizationsFromEntries(returnObjects.SelectMany(ro => ro.Organizations)); var organizationsFromUsers = GetTopLevelOrganizationsFromEntries(returnObjects.SelectMany(ro => ro.Organizations));
foreach (var entry in organizationsFromUsers) foreach (var entry in organizationsFromUsers)
{ {
var returnObjectsForOrganization = returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Contains(entry.RorUrl))).ToList(); List<ReturnObject> returnObjectsForOrganization;
// Handling of "Other" organization
if (entry.RorUrl.Equals("https://ror.org/") || entry.RorUrl.Equals("http://ror.org/"))
{
returnObjectsForOrganization = returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Equals("https://ror.org/") || e.Equals("http://ror.org/"))).ToList();
entry.RorUrl = _otherOrganization.RorUrl;
}
else
{
returnObjectsForOrganization = returnObjects.Where(ro => ro.Organizations.Select(o => o.RorUrl).Any(e => e.Contains(entry.RorUrl))).ToList();
}
var reportingFile = new ReportingFileObject var reportingFile = new ReportingFileObject
{ {
...@@ -230,12 +240,12 @@ public class UserReporting : Reporting<UserReportingOptions> ...@@ -230,12 +240,12 @@ public class UserReporting : Reporting<UserReportingOptions>
private List<Organization> CleanUpOther(List<Organization> affiliations) private List<Organization> CleanUpOther(List<Organization> affiliations)
{ {
// Special case until `https://ror.org/%20https://ror.org/` is moved to `https://ror.org/_other` // 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/") || o.RorUrl.Equals("https://ror.org/"))) if (affiliations.Any(o => o.RorUrl.Equals("https://ror.org/%20https://ror.org/") || o.RorUrl.Equals("https://ror.org/") || o.RorUrl.Equals("http://ror.org/")))
{ {
var cleanedUpAffiliations = affiliations; var cleanedUpAffiliations = affiliations;
foreach (var entry in cleanedUpAffiliations) foreach (var entry in cleanedUpAffiliations)
{ {
if (entry.RorUrl.Equals("https://ror.org/%20https://ror.org/") || entry.RorUrl.Equals("https://ror.org/")) if (entry.RorUrl.Equals("https://ror.org/%20https://ror.org/") || entry.RorUrl.Equals("https://ror.org/") || entry.RorUrl.Equals("http://ror.org/"))
{ {
cleanedUpAffiliations[cleanedUpAffiliations.IndexOf(entry)] = new() cleanedUpAffiliations[cleanedUpAffiliations.IndexOf(entry)] = new()
{ {
......