• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

HicServices / RDMP / 16070364333

04 Jul 2025 09:17AM UTC coverage: 57.436% (+0.1%) from 57.314%
16070364333

Pull #2205

github

JFriel
fix mimio tests
Pull Request #2205: Multi-Project Catalogues

11417 of 21416 branches covered (53.31%)

Branch coverage included in aggregate %.

97 of 140 new or added lines in 16 files covered. (69.29%)

32 existing lines in 4 files now uncovered.

32390 of 54855 relevant lines covered (59.05%)

17588.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

51.11
/Rdmp.Core/CommandExecution/AtomicCommands/ExecuteCommandMakeProjectSpecificCatalogueNormalAgain.cs
1
// Copyright (c) The University of Dundee 2018-2019
2
// This file is part of the Research Data Management Platform (RDMP).
3
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
6

7
using System.Collections.Generic;
8
using System.Linq;
9
using Rdmp.Core.Curation.Data;
10
using Rdmp.Core.DataExport.Data;
11
using Rdmp.Core.Icons.IconProvision;
12
using Rdmp.Core.Repositories;
13
using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision;
14
using SixLabors.ImageSharp;
15
using SixLabors.ImageSharp.PixelFormats;
16

17
namespace Rdmp.Core.CommandExecution.AtomicCommands;
18

19
public class ExecuteCommandMakeProjectSpecificCatalogueNormalAgain : BasicCommandExecution, IAtomicCommand
20
{
21
    private Catalogue _catalogue;
22
    private List<ExtractableDataSet> _extractableDataSets;
23
    private ExtractableDataSet _extractableDataSet;
24
    private Project _selectedProj;
25

26
    public ExecuteCommandMakeProjectSpecificCatalogueNormalAgain(IBasicActivateItems activator, Catalogue catalogue, ExtractableDataSet eds) :
27
        base(activator)
14✔
28
    {
29
        _catalogue = catalogue;
14✔
30
        _extractableDataSet = eds;
14✔
31

32

33
        var dataExportRepository = BasicActivator.RepositoryLocator.DataExportRepository;
14✔
34
        if (dataExportRepository == null)
14!
35
        {
36
            SetImpossible("Data Export functionality is not available");
×
37
            return;
×
38
        }
39

40
        var x = dataExportRepository.GetAllObjectsWithParent<ExtractableDataSet>(catalogue);
14✔
41
        var y = x.Where(eds => eds.Projects.Any());
14✔
42

43
        _extractableDataSets = dataExportRepository.GetAllObjectsWithParent<ExtractableDataSet>(catalogue).Where(eds => eds.Projects.Any() && eds.Projects.Select(p =>ProjectSpecificCatalogueManager.CanMakeCatalogueNonProjectSpecific(dataExportRepository, catalogue, eds,p)).Contains(true)).ToList();
46!
44
        if (!_extractableDataSets.Any())
14!
45
        {
NEW
46
            SetImpossible("Cannot make Catalogue Non-Project specific");
×
47
            return;
×
48
        }
49
        
50

51
    }
14✔
52

53
    public override string GetCommandHelp() =>
54
        "Take a dataset that was previously only usable with extractions of a specific project and make it free for use in any extraction project";
×
55

56
    public override void Execute()
57
    {
58
        base.Execute();
12✔
59
        if (_extractableDataSet is null)
12!
60
        {
NEW
61
            var dataExportRepository = BasicActivator.RepositoryLocator.DataExportRepository;
×
62

NEW
63
            var projectIds = _extractableDataSets.SelectMany(eds => eds.Projects.Where(p => ProjectSpecificCatalogueManager.CanMakeCatalogueNonProjectSpecific(dataExportRepository,_catalogue,eds,p))).Select(p => p.ID);
×
NEW
64
            _selectedProj = SelectOne<Project>(BasicActivator.RepositoryLocator.DataExportRepository.GetAllObjectsInIDList<Project>(projectIds).ToList());
×
NEW
65
            if (_selectedProj is null) return;
×
NEW
66
            _extractableDataSet = _extractableDataSets.FirstOrDefault(eds => eds.Projects.Select(p => p.ID).Contains(_selectedProj.ID));
×
67
        }
68
        if (_extractableDataSet == null)
12!
69
        {
NEW
70
            return;
×
71
        }
72

73
        if (!_extractableDataSet.Projects.Any())
12!
74
        {
NEW
75
            SetImpossible("Catalogue is not a project specific Catalogue");
×
NEW
76
            return;
×
77
        }
78

79
        ProjectSpecificCatalogueManager.MakeCatalogueNonProjectSpecific(BasicActivator.RepositoryLocator.DataExportRepository, _catalogue, _extractableDataSet,_selectedProj);
12✔
80

81
        Publish(_catalogue);
12✔
82
    }
12✔
83

84
    public override Image<Rgba32> GetImage(IIconProvider iconProvider) =>
85
        Image.Load<Rgba32>(CatalogueIcons.MakeProjectSpecificCatalogueNormalAgain);
×
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc