Index: Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_19.1_20.1.sql =================================================================== diff -u -rbd1d7eb233cb8f3d16e6e2821e2904d590df274b -r0f46535c524aa3d00d26196f3c2cdbf266caff22 --- Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_19.1_20.1.sql (.../Migration_19.1_20.1.sql) (revision bd1d7eb233cb8f3d16e6e2821e2904d590df274b) +++ Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_19.1_20.1.sql (.../Migration_19.1_20.1.sql) (revision 0f46535c524aa3d00d26196f3c2cdbf266caff22) @@ -387,7 +387,146 @@ [Value], [Order] FROM [SOURCEPROJECT].IllustrationPointResultEntity; -INSERT INTO MacroStabilityInwardsCalculationEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityInwardsCalculationEntity; +INSERT INTO MacroStabilityInwardsCalculationEntity ( + [MacroStabilityInwardsCalculationEntityId], + [CalculationGroupEntityId], + [SurfaceLineEntityId], + [MacroStabilityInwardsStochasticSoilProfileEntityId], + [HydraulicLocationEntityId], + [Order], + [Name], + [Comment], + [RelevantForScenario], + [ScenarioContribution], + [AssessmentLevel], + [UseAssessmentLevelManualInput], + [SlipPlaneMinimumDepth], + [SlipPlaneMinimumLength], + [MaximumSliceWidth], + [MoveGrid], + [GridDeterminationType], + [TangentLineDeterminationType], + [TangentLineZTop], + [TangentLineZBottom], + [TangentLineNumber], + [LeftGridXLeft], + [LeftGridXRight], + [LeftGridNrOfHorizontalPoints], + [LeftGridZTop], + [LeftGridZBottom], + [LeftGridNrOfVerticalPoints], + [RightGridXLeft], + [RightGridXRight], + [RightGridNrOfHorizontalPoints], + [RightGridZTop], + [RightGridZBottom], + [RightGridNrOfVerticalPoints], + [DikeSoilScenario], + [WaterLevelRiverAverage], + [DrainageConstructionPresent], + [DrainageConstructionCoordinateX], + [DrainageConstructionCoordinateZ], + [MinimumLevelPhreaticLineAtDikeTopRiver], + [MinimumLevelPhreaticLineAtDikeTopPolder], + [AdjustPhreaticLine3And4ForUplift], + [LeakageLengthOutwardsPhreaticLine3], + [LeakageLengthInwardsPhreaticLine3], + [LeakageLengthOutwardsPhreaticLine4], + [LeakageLengthInwardsPhreaticLine4], + [PiezometricHeadPhreaticLine2Outwards], + [PiezometricHeadPhreaticLine2Inwards], + [LocationInputExtremeWaterLevelPolder], + [LocationInputExtremeUseDefaultOffsets], + [LocationInputExtremePhreaticLineOffsetBelowDikeTopAtRiver], + [LocationInputExtremePhreaticLineOffsetBelowDikeTopAtPolder], + [LocationInputExtremePhreaticLineOffsetBelowShoulderBaseInside], + [LocationInputExtremePhreaticLineOffsetDikeToeAtPolder], + [LocationInputExtremePenetrationLength], + [LocationInputDailyWaterLevelPolder], + [LocationInputDailyUseDefaultOffsets], + [LocationInputDailyPhreaticLineOffsetBelowDikeTopAtRiver], + [LocationInputDailyPhreaticLineOffsetBelowDikeTopAtPolder], + [LocationInputDailyPhreaticLineOffsetBelowShoulderBaseInside], + [LocationInputDailyPhreaticLineOffsetDikeToeAtPolder], + [CreateZones], + [ZoningBoundariesDeterminationType], + [ZoneBoundaryLeft], + [ZoneBoundaryRight]) +SELECT + [MacroStabilityInwardsCalculationEntityId], + [CalculationGroupEntityId], + [SurfaceLineEntityId], + [MacroStabilityInwardsStochasticSoilProfileEntityId], + [HydraulicLocationEntityId], + [Order], + [Name], + [Comment], + [RelevantForScenario], + CASE + WHEN [ScenarioContribution] IS NULL + THEN 0 + WHEN [ScenarioContribution] > 1 + THEN 1 + WHEN [ScenarioContribution] < 0 + THEN 0 + ELSE + [ScenarioContribution] + END, + [AssessmentLevel], + [UseAssessmentLevelManualInput], + [SlipPlaneMinimumDepth], + [SlipPlaneMinimumLength], + [MaximumSliceWidth], + [MoveGrid], + [GridDeterminationType], + [TangentLineDeterminationType], + [TangentLineZTop], + [TangentLineZBottom], + [TangentLineNumber], + [LeftGridXLeft], + [LeftGridXRight], + [LeftGridNrOfHorizontalPoints], + [LeftGridZTop], + [LeftGridZBottom], + [LeftGridNrOfVerticalPoints], + [RightGridXLeft], + [RightGridXRight], + [RightGridNrOfHorizontalPoints], + [RightGridZTop], + [RightGridZBottom], + [RightGridNrOfVerticalPoints], + [DikeSoilScenario], + [WaterLevelRiverAverage], + [DrainageConstructionPresent], + [DrainageConstructionCoordinateX], + [DrainageConstructionCoordinateZ], + [MinimumLevelPhreaticLineAtDikeTopRiver], + [MinimumLevelPhreaticLineAtDikeTopPolder], + [AdjustPhreaticLine3And4ForUplift], + [LeakageLengthOutwardsPhreaticLine3], + [LeakageLengthInwardsPhreaticLine3], + [LeakageLengthOutwardsPhreaticLine4], + [LeakageLengthInwardsPhreaticLine4], + [PiezometricHeadPhreaticLine2Outwards], + [PiezometricHeadPhreaticLine2Inwards], + [LocationInputExtremeWaterLevelPolder], + [LocationInputExtremeUseDefaultOffsets], + [LocationInputExtremePhreaticLineOffsetBelowDikeTopAtRiver], + [LocationInputExtremePhreaticLineOffsetBelowDikeTopAtPolder], + [LocationInputExtremePhreaticLineOffsetBelowShoulderBaseInside], + [LocationInputExtremePhreaticLineOffsetDikeToeAtPolder], + [LocationInputExtremePenetrationLength], + [LocationInputDailyWaterLevelPolder], + [LocationInputDailyUseDefaultOffsets], + [LocationInputDailyPhreaticLineOffsetBelowDikeTopAtRiver], + [LocationInputDailyPhreaticLineOffsetBelowDikeTopAtPolder], + [LocationInputDailyPhreaticLineOffsetBelowShoulderBaseInside], + [LocationInputDailyPhreaticLineOffsetDikeToeAtPolder], + [CreateZones], + [ZoningBoundariesDeterminationType], + [ZoneBoundaryLeft], + [ZoneBoundaryRight] +FROM [SOURCEPROJECT].MacroStabilityInwardsCalculationEntity; INSERT INTO MacroStabilityInwardsCharacteristicPointEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityInwardsCharacteristicPointEntity; INSERT INTO MacroStabilityInwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityInwardsFailureMechanismMetaEntity; INSERT INTO MacroStabilityInwardsPreconsolidationStressEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityInwardsPreconsolidationStressEntity; @@ -436,7 +575,16 @@ [DampingFactorExitMean], [DampingFactorExitStandardDeviation], [RelevantForScenario], - [ScenarioContribution], + CASE + WHEN [ScenarioContribution] IS NULL + THEN 0 + WHEN [ScenarioContribution] > 1 + THEN 1 + WHEN [ScenarioContribution] < 0 + THEN 0 + ELSE + [ScenarioContribution] + END, [AssessmentLevel], [UseAssessmentLevelManualInput] FROM [SOURCEPROJECT].PipingCalculationEntity; @@ -754,7 +902,55 @@ DROP TABLE TempLogOutputDeleted; +CREATE TEMP TABLE TempMacroStabilityInwardsValuesAdjusted +( + 'NrAdjusted' INTEGER NOT NULL +); + +INSERT INTO TempMacroStabilityInwardsValuesAdjusted SELECT COUNT() FROM [SOURCEPROJECT].MacroStabilityInwardsCalculationEntity +WHERE ( +[ScenarioContribution] > 1.0 OR [ScenarioContribution] < 0.0 OR [ScenarioContribution] IS NULL + ); + INSERT INTO [LOGDATABASE].MigrationLogEntity ( + [FromVersion], + [ToVersion], +[LogMessage]) +SELECT + "19.1", + "20.1", + "* Alle scenario bijdragen van het toetsspoor 'Macrostabiliteit Binnenwaarts' waarbij de bijdrage groter is dan 100% of kleiner dan 0% zijn aangepast naar respectievelijk 100% en 0%." +FROM TempMacroStabilityInwardsValuesAdjusted +WHERE [NrAdjusted] > 0 + LIMIT 1; + +DROP TABLE TempMacroStabilityInwardsValuesAdjusted; + +CREATE TEMP TABLE TempPipingValuesAdjusted +( + 'NrAdjusted' INTEGER NOT NULL +); + +INSERT INTO TempPipingValuesAdjusted SELECT COUNT() FROM [SOURCEPROJECT].PipingCalculationEntity +WHERE ( + [ScenarioContribution] > 1.0 OR [ScenarioContribution] < 0.0 OR [ScenarioContribution] IS NULL + ); + +INSERT INTO [LOGDATABASE].MigrationLogEntity ( + [FromVersion], + [ToVersion], +[LogMessage]) +SELECT + "19.1", + "20.1", + "* Alle scenario bijdragen van van het toetsspoor 'Piping' waarbij de bijdrage groter is dan 100% of kleiner dan 0% zijn aangepast naar respectievelijk 100% en 0%." +FROM TempPipingValuesAdjusted +WHERE [NrAdjusted] > 0 + LIMIT 1; + +DROP TABLE TempPipingValuesAdjusted; + +INSERT INTO [LOGDATABASE].MigrationLogEntity ( [FromVersion], [ToVersion], [LogMessage]) Index: Riskeer/Migration/test/Riskeer.Migration.Core.Test/test-data/MigrationTestProject201.risk =================================================================== diff -u -r8f223d35ced102ff207cff304cefadde224a17ef -r0f46535c524aa3d00d26196f3c2cdbf266caff22 Binary files differ Index: Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo201IntegrationTest.cs =================================================================== diff -u -rbd1d7eb233cb8f3d16e6e2821e2904d590df274b -r0f46535c524aa3d00d26196f3c2cdbf266caff22 --- Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo201IntegrationTest.cs (.../MigrationTo201IntegrationTest.cs) (revision bd1d7eb233cb8f3d16e6e2821e2904d590df274b) +++ Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo201IntegrationTest.cs (.../MigrationTo201IntegrationTest.cs) (revision 0f46535c524aa3d00d26196f3c2cdbf266caff22) @@ -73,6 +73,7 @@ AssertStabilityPointStructuresCalculation(reader, sourceFilePath); AssertStabilityPointStructuresSectionResult(reader, sourceFilePath); + AssertMacroStabilityInwardsCalculation(reader, sourceFilePath); AssertMacroStabilityInwardsOutput(reader); AssertPipingCalculation(reader, sourceFilePath); @@ -86,6 +87,84 @@ } } + private static void AssertMacroStabilityInwardsCalculation(MigratedDatabaseReader reader, string sourceFilePath) + { + string validateCalculation = + $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT;" + + "SELECT COUNT() = " + + "(" + + "SELECT COUNT() " + + "FROM [SOURCEPROJECT].MacroStabilityInwardsCalculationEntity " + + ")" + + "FROM MacroStabilityInwardsCalculationEntity NEW " + + "JOIN [SOURCEPROJECT].MacroStabilityInwardsCalculationEntity OLD USING(MacroStabilityInwardsCalculationEntityId) " + + "WHERE NEW.[MacroStabilityInwardsCalculationEntityId] = OLD.[MacroStabilityInwardsCalculationEntityId] " + + "AND NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " + + "AND NEW.[SurfaceLineEntityId] IS OLD.[SurfaceLineEntityId] " + + "AND NEW.[MacroStabilityInwardsStochasticSoilProfileEntityId] IS OLD.[MacroStabilityInwardsStochasticSoilProfileEntityId] " + + "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " + + "AND NEW.[Order] = OLD.[Order] " + + "AND NEW.[Name] IS OLD.[Name] " + + "AND NEW.[Comment] IS OLD.[Comment] " + + "AND NEW.[RelevantForScenario] = OLD.[RelevantForScenario] " + + "AND NEW.[AssessmentLevel] IS OLD.[AssessmentLevel] " + + "AND NEW.[UseAssessmentLevelManualInput] = OLD.[UseAssessmentLevelManualInput] " + + "AND NEW.[SlipPlaneMinimumDepth] IS OLD.[SlipPlaneMinimumDepth] " + + "AND NEW.[SlipPlaneMinimumLength] IS OLD.[SlipPlaneMinimumLength] " + + "AND NEW.[MaximumSliceWidth] IS OLD.[MaximumSliceWidth] " + + "AND NEW.[MoveGrid] = OLD.[MoveGrid] " + + "AND NEW.[GridDeterminationType] = OLD.[GridDeterminationType] " + + "AND NEW.[TangentLineDeterminationType] = OLD.[TangentLineDeterminationType] " + + "AND NEW.[TangentLineZTop] IS OLD.[TangentLineZTop] " + + "AND NEW.[TangentLineZBottom] IS OLD.[TangentLineZBottom] " + + "AND NEW.[TangentLineNumber] = OLD.[TangentLineNumber] " + + "AND NEW.[LeftGridXLeft] IS OLD.[LeftGridXLeft] " + + "AND NEW.[LeftGridXRight] IS OLD.[LeftGridXRight] " + + "AND NEW.[LeftGridNrOfHorizontalPoints] = OLD.[LeftGridNrOfHorizontalPoints] " + + "AND NEW.[LeftGridZTop] IS OLD.[LeftGridZTop] " + + "AND NEW.[LeftGridZBottom] IS OLD.[LeftGridZBottom] " + + "AND NEW.[LeftGridNrOfVerticalPoints] = OLD.[LeftGridNrOfVerticalPoints] " + + "AND NEW.[RightGridXLeft] IS OLD.[RightGridXLeft] " + + "AND NEW.[RightGridXRight] IS OLD.[RightGridXRight] " + + "AND NEW.[RightGridNrOfHorizontalPoints] = OLD.[RightGridNrOfHorizontalPoints] " + + "AND NEW.[RightGridZTop] IS OLD.[RightGridZTop] " + + "AND NEW.[RightGridZBottom] IS OLD.[RightGridZBottom] " + + "AND NEW.[RightGridNrOfVerticalPoints] = OLD.[RightGridNrOfVerticalPoints] " + + "AND NEW.[DikeSoilScenario] = OLD.[DikeSoilScenario] " + + "AND NEW.[WaterLevelRiverAverage] IS OLD.[WaterLevelRiverAverage] " + + "AND NEW.[DrainageConstructionPresent] = OLD.[DrainageConstructionPresent] " + + "AND NEW.[DrainageConstructionCoordinateX] IS OLD.[DrainageConstructionCoordinateX] " + + "AND NEW.[DrainageConstructionCoordinateZ] IS OLD.[DrainageConstructionCoordinateZ] " + + "AND NEW.[MinimumLevelPhreaticLineAtDikeTopRiver] IS OLD.[MinimumLevelPhreaticLineAtDikeTopRiver] " + + "AND NEW.[MinimumLevelPhreaticLineAtDikeTopPolder] IS OLD.[MinimumLevelPhreaticLineAtDikeTopPolder] " + + "AND NEW.[AdjustPhreaticLine3And4ForUplift] = OLD.[AdjustPhreaticLine3And4ForUplift] " + + "AND NEW.[LeakageLengthOutwardsPhreaticLine3] IS OLD.[LeakageLengthOutwardsPhreaticLine3] " + + "AND NEW.[LeakageLengthInwardsPhreaticLine3] IS OLD.[LeakageLengthInwardsPhreaticLine3] " + + "AND NEW.[LeakageLengthOutwardsPhreaticLine4] IS OLD.[LeakageLengthOutwardsPhreaticLine4] " + + "AND NEW.[LeakageLengthInwardsPhreaticLine4] IS OLD.[LeakageLengthInwardsPhreaticLine4] " + + "AND NEW.[PiezometricHeadPhreaticLine2Outwards] IS OLD.[PiezometricHeadPhreaticLine2Outwards] " + + "AND NEW.[PiezometricHeadPhreaticLine2Inwards] IS OLD.[PiezometricHeadPhreaticLine2Inwards] " + + "AND NEW.[LocationInputExtremeWaterLevelPolder] IS OLD.[LocationInputExtremeWaterLevelPolder] " + + "AND NEW.[LocationInputExtremeUseDefaultOffsets] = OLD.[LocationInputExtremeUseDefaultOffsets] " + + "AND NEW.[LocationInputExtremePhreaticLineOffsetBelowDikeTopAtRiver] IS OLD.[LocationInputExtremePhreaticLineOffsetBelowDikeTopAtRiver] " + + "AND NEW.[LocationInputExtremePhreaticLineOffsetBelowDikeTopAtPolder] IS OLD.[LocationInputExtremePhreaticLineOffsetBelowDikeTopAtPolder] " + + "AND NEW.[LocationInputExtremePhreaticLineOffsetBelowShoulderBaseInside] IS OLD.[LocationInputExtremePhreaticLineOffsetBelowShoulderBaseInside] " + + "AND NEW.[LocationInputExtremePhreaticLineOffsetDikeToeAtPolder] IS OLD.[LocationInputExtremePhreaticLineOffsetDikeToeAtPolder] " + + "AND NEW.[LocationInputExtremePenetrationLength] IS OLD.[LocationInputExtremePenetrationLength] " + + "AND NEW.[LocationInputDailyWaterLevelPolder] IS OLD.[LocationInputDailyWaterLevelPolder] " + + "AND NEW.[LocationInputDailyUseDefaultOffsets] = OLD.[LocationInputDailyUseDefaultOffsets] " + + "AND NEW.[LocationInputDailyPhreaticLineOffsetBelowDikeTopAtRiver] IS OLD.[LocationInputDailyPhreaticLineOffsetBelowDikeTopAtRiver] " + + "AND NEW.[LocationInputDailyPhreaticLineOffsetBelowDikeTopAtPolder] IS OLD.[LocationInputDailyPhreaticLineOffsetBelowDikeTopAtPolder] " + + "AND NEW.[LocationInputDailyPhreaticLineOffsetBelowShoulderBaseInside] IS OLD.[LocationInputDailyPhreaticLineOffsetBelowShoulderBaseInside] " + + "AND NEW.[LocationInputDailyPhreaticLineOffsetDikeToeAtPolder] IS OLD.[LocationInputDailyPhreaticLineOffsetDikeToeAtPolder] " + + "AND NEW.[CreateZones] = OLD.[CreateZones] " + + "AND NEW.[ZoningBoundariesDeterminationType] = OLD.[ZoningBoundariesDeterminationType] " + + "AND NEW.[ZoneBoundaryLeft] IS OLD.[ZoneBoundaryLeft] " + + "AND NEW.[ZoneBoundaryRight] IS OLD.[ZoneBoundaryRight]; " + + "DETACH SOURCEPROJECT;"; + reader.AssertReturnedDataIsValid(validateCalculation); + } + private static void AssertGrassCoverErosionInwardsCalculation(MigratedDatabaseReader reader, string sourceFilePath) { string validateCalculationLinkedToSectionResult = @@ -659,7 +738,6 @@ "AND NEW.[DampingFactorExitMean] IS OLD.[DampingFactorExitMean] " + "AND NEW.[DampingFactorExitStandardDeviation] IS OLD.[DampingFactorExitStandardDeviation] " + "AND NEW.[RelevantForScenario] = OLD.[RelevantForScenario] " + - "AND NEW.[ScenarioContribution] IS OLD.[ScenarioContribution] " + "AND NEW.[AssessmentLevel] IS OLD.[AssessmentLevel] " + "AND NEW.[UseAssessmentLevelManualInput] = OLD.[UseAssessmentLevelManualInput]; " + "DETACH SOURCEPROJECT;"; @@ -874,7 +952,13 @@ messages[i++]); MigrationLogTestHelper.AssertMigrationLogMessageEqual( new MigrationLogMessage("19.1", newVersion, "* Alle berekende resultaten van het toetsspoor 'Piping' waarbij de waterstand handmatig is ingevuld zijn verwijderd."), - messages[i]); + messages[i++]); + // MigrationLogTestHelper.AssertMigrationLogMessageEqual( + // new MigrationLogMessage("19.1", newVersion, "* Alle scenario bijdragen van het toetsspoor 'Macrostabiliteit Binnenwaarts' waarbij de bijdrage groter is dan 100% of kleiner dan 0% zijn aangepast naar respectievelijk 100% en 0%."), + // messages[i++]); + // MigrationLogTestHelper.AssertMigrationLogMessageEqual( + // new MigrationLogMessage("19.1", newVersion, "* Alle scenario bijdragen van van het toetsspoor 'Piping' waarbij de bijdrage groter is dan 100% of kleiner dan 0% zijn aangepast naar respectievelijk 100% en 0%."), + // messages[i]); } } }