Skip to content

Commit

Permalink
Merge pull request #1885 from HicServices/task/RDMP-208-cohort-versio…
Browse files Browse the repository at this point in the history
…ning-improvements

Task/rdmp 208 cohort versioning improvements
  • Loading branch information
rdteviotdale authored Aug 7, 2024
2 parents 90591b9 + f947cb2 commit db0e0db
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [8.2.4] - Unreleased

- Add instance setting to prompt for cohort versioning when comitting
- Improve Cohort Versioning Interface

## [8.2.3] - 2024-08-05
Expand All @@ -29,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add Release status options to the ticketing system
- Improve Interface for Lookup table generation
- Improve read/write access to plugin files for linux systems
- Add directory validity checking to data loads
- Open plugin files read-only to avoid permissions errors on Linux
- Improve PK mapping for ExtractionIdentifiers when extracting data
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// 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.
// 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.
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Linq;
using Rdmp.Core.Curation.Data;
using Rdmp.Core.Curation.Data.Cohort;
Expand All @@ -13,6 +14,7 @@
using Rdmp.Core.Providers;
using Rdmp.Core.Repositories.Construction;
using Rdmp.Core.ReusableLibraryCode.Icons.IconProvision;
using Rdmp.Core.Setting;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;

Expand Down Expand Up @@ -68,7 +70,19 @@ public override void Execute()
if (cic == null)
return;

if (BasicActivator.IsInteractive) {
var PromptForVersionOnCohortCommit = false;
var PromptForVersionOnCohortCommitSetting = BasicActivator.RepositoryLocator.CatalogueRepository.GetAllObjects<Setting.Setting>().Where(s => s.Key == "PromptForVersionOnCohortCommit").FirstOrDefault();
if (PromptForVersionOnCohortCommitSetting is not null) PromptForVersionOnCohortCommit = Convert.ToBoolean(PromptForVersionOnCohortCommitSetting.Value);
if (PromptForVersionOnCohortCommit && BasicActivator.YesNo("It is recommended to save your cohort as a new version before committing. Would you like to do this?", "Save cohort as new version before committing?"))
{
var newVersion = new ExecuteCommandCreateVersionOfCohortConfiguration(BasicActivator, cic);
newVersion.Execute();
var versions = cic.GetVersions();
cic = versions.Last();
}

}
if (Project == null && BasicActivator.CoreChildProvider is DataExportChildProvider dx)
{
var projAssociations = dx.AllProjectAssociatedCics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public override void Execute()
{
CloneCreatedIfAny.Version = _version;
//If no name is provided, use the existing name, but repalce the "(Clone) with the version number"
CloneCreatedIfAny.Name = _name ?? $"{CloneCreatedIfAny.Name[..^7]}:{CloneCreatedIfAny.Version}";
if(CloneCreatedIfAny.Version != null)
CloneCreatedIfAny.Name = _name ?? $"{CloneCreatedIfAny.Name[..^7]}:{CloneCreatedIfAny.Version}";
if (_version is not null)
CloneCreatedIfAny.Frozen = true;
CloneCreatedIfAny.SaveToDatabase();
Expand Down
13 changes: 13 additions & 0 deletions Rdmp.UI/SimpleDialogs/InstanceSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Rdmp.UI/SimpleDialogs/InstanceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public InstanceSettings(IActivateItems activator)
_settings = _activator.RepositoryLocator.CatalogueRepository.GetAllObjects<Setting>();

RegisterCheckbox(cbAutoSuggestProjectNumbers, "AutoSuggestProjectNumbers");
RegisterCheckbox(cbCohortVersioningOnCommit, "PromptForVersionOnCohortCommit");
_loaded = true;
}

Expand Down

0 comments on commit db0e0db

Please sign in to comment.