Skip to content

Commit

Permalink
Created tag for Ringtoets version 17.1.1
Browse files Browse the repository at this point in the history
Related to Issue [WTI-1313]


git-svn-id: https://repos.deltares.nl/repos/WettelijkToetsInstrumentarium/tags/17_1_1@10353 5a3db67b-de53-47b5-99c8-a1c30a6650e2

Former-commit-id: 5ff9d0a2b839b11badf3507d04d203d7d21f1262
Former-commit-id: 7f8508d04f5689fe94663e43376653fb05864990
  • Loading branch information
Marten Janssen committed Jun 19, 2017
2 parents bb0cfd6 + 825b033 commit e1e552e
Show file tree
Hide file tree
Showing 45 changed files with 689 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TargetProject version: 17.1
*/
PRAGMA foreign_keys = OFF;

ATTACH DATABASE [{0}] AS SOURCEPROJECT;
ATTACH DATABASE '{0}' AS SOURCEPROJECT;

INSERT INTO AssessmentSectionEntity SELECT * FROM [SOURCEPROJECT].AssessmentSectionEntity;
INSERT INTO CalculationGroupEntity SELECT * FROM [SOURCEPROJECT].CalculationGroupEntity;
Expand Down Expand Up @@ -35,7 +35,7 @@ SELECT
CASE WHEN Suffix THEN [Name] ||
SUBSTR(QUOTE(ZEROBLOB((SuffixPreLength + 1) / 2)), 3, SuffixPreLength)
|| Suffix ELSE [Name] END as [Id],
CASE WHEN Suffix THEN [Name] || '(' || Suffix || ')' ELSE [Name] END as [Name],
[Name],
[Orientation],
[BreakWaterType],
[BreakWaterHeight],
Expand All @@ -46,7 +46,7 @@ SELECT
[Y],
[X0],
[Order]
FROM (SELECT *, MaxLength - LENGTH(NAME) as SuffixPreLength, (SELECT count(*)
FROM (SELECT *, MaxLength - LENGTH(NAME) as SuffixPreLength, (SELECT DP.rowid
FROM [SOURCEPROJECT].DikeProfileEntity
WHERE DP.DikeProfileEntityId > DikeProfileEntityId
AND DP.Name IS Name
Expand Down Expand Up @@ -85,39 +85,39 @@ SELECT
FROM [SOURCEPROJECT].ForeshoreProfileEntity;
INSERT INTO GrassCoverErosionInwardsCalculationEntity (
[GrassCoverErosionInwardsCalculationEntityId],
[CalculationGroupEntityId],
[HydraulicLocationEntityId],
[DikeProfileEntityId],
[Order],
[Name],
[Comments],
[Orientation],
[CriticalFlowRateMean],
[CriticalFlowRateStandardDeviation],
[UseForeshore],
[DikeHeightCalculationType],
[DikeHeight],
[UseBreakWater],
[BreakWaterType],
[BreakWaterHeight],
[CalculationGroupEntityId],
[HydraulicLocationEntityId],
[DikeProfileEntityId],
[Order],
[Name],
[Comments],
[Orientation],
[CriticalFlowRateMean],
[CriticalFlowRateStandardDeviation],
[UseForeshore],
[DikeHeightCalculationType],
[DikeHeight],
[UseBreakWater],
[BreakWaterType],
[BreakWaterHeight],
[OvertoppingRateCalculationType])
SELECT
[GrassCoverErosionInwardsCalculationEntityId],
[CalculationGroupEntityId],
[HydraulicLocationEntityId],
[DikeProfileEntityId],
[Order],
[Name],
[Comments],
[Orientation],
[CriticalFlowRateMean],
[CriticalFlowRateStandardDeviation],
[UseForeshore],
[DikeHeightCalculationType],
[DikeHeight],
[UseBreakWater],
[BreakWaterType],
[BreakWaterHeight],
[CalculationGroupEntityId],
[HydraulicLocationEntityId],
[DikeProfileEntityId],
[Order],
[Name],
[Comments],
[Orientation],
[CriticalFlowRateMean],
[CriticalFlowRateStandardDeviation],
[UseForeshore],
[DikeHeightCalculationType],
[DikeHeight],
[UseBreakWater],
[BreakWaterType],
[BreakWaterHeight],
1
FROM [SOURCEPROJECT].GrassCoverErosionInwardsCalculationEntity;
INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity (
Expand Down Expand Up @@ -189,20 +189,35 @@ INSERT INTO StabilityPointStructuresFailureMechanismMetaEntity SELECT * FROM [SO
INSERT INTO StabilityPointStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresSectionResultEntity;
INSERT INTO StabilityStoneCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverSectionResultEntity;
INSERT INTO StabilityStoneCoverWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsCalculationEntity;
INSERT INTO StochasticSoilModelEntity
INSERT INTO StochasticSoilModelEntity (
[StochasticSoilModelEntityId],
[FailureMechanismEntityId],
[Name],
[SegmentName],
[StochasticSoilModelSegmentPointXml],
[Order])
SELECT
[StochasticSoilModelEntityId],
[FailuremechanismEntityId],
CASE WHEN Suffix THEN [Name] || '(' || Suffix || ')' ELSE [Name] END as [Name],
CASE WHEN Suffix THEN [Name] || ' (' || SUBSTR(QUOTE(ZEROBLOB((SuffixPreLength + 1) / 2)), 3, SuffixPreLength) || Suffix || ')' ELSE [Name] END AS [Name],
[SegmentName],
[StochasticSoilModelSegmentPointXml],
[Order]
FROM (SELECT *, (SELECT count(*)
FROM [SOURCEPROJECT].StochasticSoilModelEntity
WHERE SSM.StochasticSoilModelEntityId > StochasticSoilModelEntityId
AND SSM.Name IS Name
AND SSM.FailuremechanismEntityId = FailuremechanismEntityId) as Suffix
FROM [SOURCEPROJECT].StochasticSoilModelEntity SSM);
FROM
(
SELECT *, MAX(MaxLength - LENGTH(NAME), 0) as SuffixPreLength,
(
SELECT COUNT()
FROM [SOURCEPROJECT].StochasticSoilModelEntity
WHERE SSM.StochasticSoilModelEntityId > StochasticSoilModelEntityId
AND SSM.Name IS Name
AND SSM.FailuremechanismEntityId = FailuremechanismEntityId
) AS Suffix
FROM [SOURCEPROJECT].StochasticSoilModelEntity SSM
JOIN (
SELECT MAX(LENGTH(Name)-3) as MaxLength FROM [SOURCEPROJECT].StochasticSoilModelEntity
)
);
INSERT INTO StochasticSoilProfileEntity
SELECT
[StochasticSoilProfileEntityId],
Expand All @@ -216,21 +231,37 @@ SELECT
[Order]
FROM [SOURCEPROJECT].StochasticSoilProfileEntity;
INSERT INTO StrengthStabilityLengthwiseConstructionSectionResultEntity SELECT * FROM [SOURCEPROJECT].StrengthStabilityLengthwiseConstructionSectionResultEntity;
INSERT INTO SurfaceLineEntity
INSERT INTO SurfaceLineEntity (
[SurfaceLineEntityId],
[FailureMechanismEntityId],
[Name],
[ReferenceLineIntersectionX],
[ReferenceLineIntersectionY],
[PointsXml],
[Order])
SELECT
[SurfaceLineEntityId],
[FailuremechanismEntityId],
CASE WHEN Suffix THEN [Name] || '(' || Suffix || ')' ELSE [Name] END as [Name],
CASE WHEN Suffix THEN [Name] || ' (' || SUBSTR(QUOTE(ZEROBLOB((SuffixPreLength + 1) / 2)), 3, SuffixPreLength) || Suffix || ')' ELSE [Name] END AS [Name],
[ReferenceLineIntersectionX],
[ReferenceLineIntersectionY],
[PointsXml],
[Order]
FROM (SELECT *, (SELECT count(*)
FROM [SOURCEPROJECT].SurfaceLineEntity
WHERE SL.SurfaceLineEntityId > SurfaceLineEntityId
AND SL.Name IS Name
AND SL.FailuremechanismEntityId = FailuremechanismEntityId) as Suffix
FROM [SOURCEPROJECT].SurfaceLineEntity SL);
[Order]
FROM
(
SELECT *, MAX(MaxLength - LENGTH(NAME), 0) as SuffixPreLength,
(
SELECT COUNT()
FROM [SOURCEPROJECT].SurfaceLineEntity
WHERE SL.SurfaceLineEntityId > SurfaceLineEntityId
AND SL.Name IS Name
AND SL.FailuremechanismEntityId = FailuremechanismEntityId
) AS Suffix
FROM [SOURCEPROJECT].SurfaceLineEntity SL
JOIN (
SELECT MAX(LENGTH(Name)-3) as MaxLength FROM [SOURCEPROJECT].SurfaceLineEntity
)
);
INSERT INTO TechnicalInnovationSectionResultEntity SELECT * FROM [SOURCEPROJECT].TechnicalInnovationSectionResultEntity;
INSERT INTO VersionEntity (
[VersionId],
Expand Down Expand Up @@ -295,7 +326,7 @@ SELECT BackgroundDataEntityId,
/*
Write migration logging
*/
ATTACH DATABASE [{1}] AS LOGDATABASE;
ATTACH DATABASE '{1}' AS LOGDATABASE;

CREATE TEMP TABLE log_output_deleted (
'NrDeleted' INTEGER NOT NULL
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@ public class MigrationTo171IntegrationTest
{
private const string newVersion = "17.1";

[Test]
public void Given164Project_WhenMigratingTo171WithSquareBracketsInPath_DoesNotThrowException()
{
// Given
string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration.Core,
"Empty valid [Release 16.4].rtd");
var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath);

const string name = nameof(Given164Project_WhenMigratingTo171WithSquareBracketsInPath_DoesNotThrowException);
string targetFilePath = TestHelper.GetScratchPadPath(name);
string logFilePath = TestHelper.GetScratchPadPath(string.Concat(name, "[Release 16.4]", ".log"));
var migrator = new RingtoetsSqLiteDatabaseFileMigrator
{
LogPath = logFilePath
};

using (new FileDisposeHelper(logFilePath))
using (new FileDisposeHelper(targetFilePath))
{
// When
TestDelegate call = () => migrator.Migrate(fromVersionedFile, newVersion, targetFilePath);

// Then
Assert.DoesNotThrow(call);
}
}

[Test]
public void Given164Project_WhenUpgradedTo171_ThenProjectAsExpected()
{
Expand Down Expand Up @@ -157,8 +184,9 @@ private static void AssertTablesContentMigrated(MigratedDatabaseReader reader, s
private static void AssertDikeProfiles(MigratedDatabaseReader reader)
{
const string validateDikeProfiles =
"SELECT COUNT(DISTINCT(Name)) = COUNT() " +
"AND COUNT(DISTINCT(Id)) = COUNT() FROM DikeProfileEntity";
"SELECT COUNT(DISTINCT(Id)) = COUNT() " +
"FROM DikeProfileEntity " +
"GROUP BY [FailureMechanismEntityId]";
reader.AssertReturnedDataIsValid(validateDikeProfiles);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public class GrassCoverErosionInwardsOutputProperties : ObjectProperties<GrassCo
public bool DynamicVisibleValidationMethod(string propertyName)
{
return propertyName.Contains(nameof(DikeHeight)) && data.DikeHeightOutput != null
|| propertyName.Contains(nameof(OvertoppingRate)) && data.OvertoppingRateOutput != null;
|| propertyName.Contains(nameof(OvertoppingRate)) && data.OvertoppingRateOutput != null
|| propertyName.Equals(nameof(WaveHeight)) && !double.IsNaN(data.WaveHeight);
}

#region GrassCoverErosionInwards result
Expand Down Expand Up @@ -109,6 +110,7 @@ public RoundedDouble FactorOfSafety
}

[PropertyOrder(6)]
[DynamicVisible]
[ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result), 1, 3)]
[ResourcesDisplayName(typeof(GrassCoverErosionInwardsFormsResources), nameof(GrassCoverErosionInwardsFormsResources.GrassCoverErosionInwardsOutput_WaveHeight_Displayname))]
[ResourcesDescription(typeof(GrassCoverErosionInwardsFormsResources), nameof(GrassCoverErosionInwardsFormsResources.GrassCoverErosionInwardsOutput_WaveHeight_Description))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

using System;
using System.Collections.Generic;
using System.Linq;
using Core.Common.Base;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Exceptions;
Expand Down Expand Up @@ -68,7 +69,10 @@ public GrassCoverErosionInwardsDikeProfileReplaceDataStrategy(GrassCoverErosionI

protected override IEnumerable<IObservable> ClearData(GrassCoverErosionInwardsFailureMechanism failureMechanism)
{
return GrassCoverErosionInwardsDataSynchronizationService.RemoveAllDikeProfiles(failureMechanism);
return GrassCoverErosionInwardsDataSynchronizationService.RemoveAllDikeProfiles(
failureMechanism.Calculations.Cast<GrassCoverErosionInwardsCalculation>(),
failureMechanism.DikeProfiles,
failureMechanism.SectionResults);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ protected override IEnumerable<IObservable> UpdateObjectAndDependentData(DikePro

protected override IEnumerable<IObservable> RemoveObjectAndDependentData(DikeProfile removedObject)
{
return GrassCoverErosionInwardsDataSynchronizationService.RemoveDikeProfile(FailureMechanism,
removedObject);
return GrassCoverErosionInwardsDataSynchronizationService.RemoveDikeProfile(
removedObject,
FailureMechanism.Calculations.Cast<GrassCoverErosionInwardsCalculation>(),
FailureMechanism.DikeProfiles,
FailureMechanism.SectionResults);
}

private IEnumerable<IObservable> UpdateDikeDependentData(DikeProfile objectToUpdate)
Expand All @@ -99,6 +102,11 @@ private IEnumerable<IObservable> UpdateDikeDependentData(DikeProfile objectToUpd
affectedObjects.Add(calculation.InputParameters);
affectedObjects.AddRange(RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation));

if (!objectToUpdate.ForeshoreGeometry.Any())
{
calculation.InputParameters.UseForeshore = false;
}

GrassCoverErosionInwardsHelper.UpdateCalculationToSectionResultAssignments(
FailureMechanism.SectionResults,
FailureMechanism.Calculations.Cast<GrassCoverErosionInwardsCalculation>());
Expand Down
Loading

0 comments on commit e1e552e

Please sign in to comment.