Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextRelease to master #2016

Merged
merged 107 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
a3090d3
DROTH-3170 Added functions for getting ChangeInfo correctly, added va…
anttiahopeltositowise Mar 21, 2022
ab8a0e2
DROTH-3170 fixed mainlane amount validation
anttiahopeltositowise Mar 21, 2022
06e29d1
DROTH-3170 fixed changeType value
anttiahopeltositowise Apr 1, 2022
d3e1d75
DROTH-3170 Lenghtened OK, others Work in Progress
anttiahopeltositowise Apr 1, 2022
390ba3f
DROTH-3170 Divided changes fixed
anttiahopeltositowise Apr 1, 2022
bafc1eb
DROTH-3170 Cases 2,3,4,5a,5b fixed and tested
anttiahopeltositowise Apr 8, 2022
b647699
DROTH-3170 All cases fixed and unit tested
anttiahopeltositowise Apr 11, 2022
cad3609
DROTH-3170 Fixed Saving changes
anttiahopeltositowise Apr 11, 2022
2cc2285
DROTH-3207 Daily Batch timings now only on work days
anttiahopeltositowise Apr 11, 2022
d53a052
Merge pull request #1934 from finnishtransportagency/DROTH-3207_fix_d…
anttiahopeltositowise Apr 11, 2022
cc68861
DROTH-3207 Fixed mistake in cron day-of-the-month
anttiahopeltositowise Apr 11, 2022
2d1dff6
Merge pull request #1936 from finnishtransportagency/DROTH-3207_cron_…
anttiahopeltositowise Apr 12, 2022
d0a09f2
Merge pull request #1935 from finnishtransportagency/DROTH-3204_inrea…
sasuolanderSito Apr 12, 2022
70e1ee4
DROTH-3170 Fixes according to code review, fixed bug with determining…
anttiahopeltositowise Apr 12, 2022
ae0a6ec
DROTH-3170 fixes suggested in code review
anttiahopeltositowise Apr 13, 2022
1be868c
Merge pull request #1933 from finnishtransportagency/DROTH-3170_chang…
anttiahopeltositowise Apr 13, 2022
df70d23
DROTH-3170 fixed bug and unit test
anttiahopeltositowise Apr 13, 2022
df117f7
Merge pull request #1937 from finnishtransportagency/DROTH-3170_build…
anttiahopeltositowise Apr 13, 2022
b13e491
Merge pull request #1939 from finnishtransportagency/DROTH-3210_make_…
sasuolanderSito Apr 13, 2022
8297b2d
Merge branch 'development' into master
sasuolanderSito Apr 13, 2022
8bf860a
Merge pull request #1940 from finnishtransportagency/master
sasuolanderSito Apr 13, 2022
68863e9
DROTH-3175 fixed bug with saving changed lanes. Only new lanes saved …
anttiahopeltositowise Apr 14, 2022
475bbfc
Merge pull request #1950 from finnishtransportagency/DROTH-3175_fix_s…
anttiahopeltositowise Apr 19, 2022
ea2ff04
DROTH-3156 new role check UI
sasuolanderSito Apr 12, 2022
1f19828
DROTH-3156 add lane authorization
sasuolanderSito Apr 12, 2022
2ad190a
DROTH-3156 backend validation for lane user
sasuolanderSito Apr 12, 2022
740872b
DROTH-3156 remove comment
sasuolanderSito Apr 20, 2022
9cc43e2
DROTH-3156 remove unneeded handleSuggestedAsset
sasuolanderSito Apr 20, 2022
dd9a06f
DROTH-3156 add new role
sasuolanderSito Apr 12, 2022
f8b97f3
DROTH-3156 fix new user ui disable button when selecting laneMaintainer
sasuolanderSito Apr 20, 2022
9451b3e
DROTH-3104 Added "update only start dates" option for lanes CSV impor…
anttiahopeltositowise Apr 25, 2022
0176ee0
Merge pull request #1951 from finnishtransportagency/master
sasuolanderSito Apr 27, 2022
be5c4ac
Merge pull request #1957 from finnishtransportagency/DROTH-3198_Updat…
anttiahopeltositowise Apr 27, 2022
4751e50
DROTH-3109 sidecode filtering to createmultilanes to fix api error
SWJPTulijoki Mar 24, 2022
d943c3e
DROTH-3109 Functionality for splitting lanes multiple times
SWJPTulijoki Apr 25, 2022
660d603
DROTH-3109 improved lane split functionality after review
SWJPTulijoki Apr 27, 2022
9df78c7
DROTH-3109 improvements based on comments
SWJPTulijoki Apr 27, 2022
0a93df2
Merge pull request #1958 from finnishtransportagency/DROTH-3109_lane_…
SWJPTulijoki Apr 28, 2022
2a38a39
DROTH-3129 remove complementary geometry choice from lane modelling
SWJPTulijoki Apr 28, 2022
66f59be
Merge pull request #1959 from finnishtransportagency/DROTH-3219_remov…
SWJPTulijoki Apr 29, 2022
48c382f
DROTH-3156 remove unneeded isState road check
sasuolanderSito May 2, 2022
ee9ae00
Merge pull request #1952 from finnishtransportagency/DROTH-3156_lane_…
sasuolanderSito May 2, 2022
17f50b5
Merge pull request #1960 from finnishtransportagency/DROTH-3156_lane_…
sasuolanderSito May 3, 2022
2924d9a
DROTH-3109 Alter change messaging to acknowledge several lane splits
SWJPTulijoki May 9, 2022
36c5678
Merge pull request #1964 from finnishtransportagency/DROTH-3219_remov…
SWJPTulijoki May 10, 2022
d83abae
Merge pull request #1963 from finnishtransportagency/DROTH-3109_lane_…
SWJPTulijoki May 10, 2022
d592ed3
Merge pull request #1967 from finnishtransportagency/DROTH-3198_Updat…
anttiahopeltositowise May 17, 2022
3c87c2d
Merge pull request #1969 from finnishtransportagency/DROTH-3198_Updat…
anttiahopeltositowise May 18, 2022
b3269a3
Merge branch 'DROTH-3170_change_lanes_fixed' into DROTH-3170_changeLa…
anttiahopeltositowise May 18, 2022
d3b86cc
Merge branch 'DROTH-3170_build_fix' into DROTH-3170_changeLanes_to_Ne…
anttiahopeltositowise May 18, 2022
5927a92
Merge branch 'DROTH-3175_fix_saving_changes' into DROTH-3170_changeLa…
anttiahopeltositowise May 18, 2022
b4d742b
Merge pull request #1970 from finnishtransportagency/DROTH-3170_chang…
anttiahopeltositowise May 18, 2022
1989d70
Merge pull request #1972 from finnishtransportagency/DROTH-3198_Updat…
anttiahopeltositowise May 19, 2022
cd185e1
DROTH-3129 Group road address that exist on same link, road and road …
reetta-kivisto May 20, 2022
c857699
DROTH-3129 Return option instead of Any
reetta-kivisto May 20, 2022
2ce1d2d
DROTH-3129 Code rearrangement
reetta-kivisto May 20, 2022
8b89c82
DROTH-3129 Combine addresses that are within same link
reetta-kivisto May 20, 2022
2ea9589
Merge branch 'development' into MasterIntoDevelopment
sasuolanderSito May 23, 2022
0f3fefe
Merge pull request #1978 from finnishtransportagency/MasterIntoDevelo…
sasuolanderSito May 23, 2022
d63d8fb
Merge pull request #1979 from finnishtransportagency/DROTH-3258_add_b…
sasuolanderSito May 23, 2022
bfaf84e
DROTH-3129 Process addresses by road links
reetta-kivisto May 23, 2022
2831e85
DROTH-3129 Grouping of lanes to reusable method
reetta-kivisto May 23, 2022
ead4790
DROTH-3129 Assure that clicked lane is within adjusted lanes
reetta-kivisto May 23, 2022
6e6936e
DROTH-3129 Rename LaneRoadAddressInfo parameters
reetta-kivisto May 24, 2022
8487ce9
DROTH-3129 Change to more descriptive parameter naming
reetta-kivisto May 24, 2022
8b3eb64
DROTH-3104 Added start and end date to mainlane form
anttiahopeltositowise May 24, 2022
9b77010
DROTH-3129 Condition fixes
reetta-kivisto May 24, 2022
a808be4
DROTH-3129 Change to named boolean variables
reetta-kivisto May 24, 2022
aefe211
DROTH-3129 Fix after LaneRoadAddressInfo renaming
reetta-kivisto May 24, 2022
4cc7670
DROTH-3129 Use case class with lane endpoints
reetta-kivisto May 24, 2022
581727c
DROTH-3104 fixed bug with updating lanes
anttiahopeltositowise May 25, 2022
514be14
DROTH-3129 Fix return value
reetta-kivisto May 25, 2022
375352b
Merge pull request #1984 from finnishtransportagency/DROTH-3198_Updat…
anttiahopeltositowise May 25, 2022
eba9f9d
Merge remote-tracking branch 'origin/DROTH-3109_lane_split_problems_b…
anttiahopeltositowise May 25, 2022
dacf6dc
Merge remote-tracking branch 'origin/DROTH-3129_Problems_with_adding_…
anttiahopeltositowise May 25, 2022
80da2ed
DROTH-3129 Add tests for lane endpoint determination
reetta-kivisto May 27, 2022
5b44819
DROTH-3129 New RoadLinkWithAddresses case class added
reetta-kivisto May 27, 2022
0cc8c41
Merge pull request #1985 from finnishtransportagency/DROTH-3198_Updat…
anttiahopeltositowise May 30, 2022
d23755d
DROTH-3129 Rename inInitialAndEndRoadPart to inStartAndEndRoadPart
reetta-kivisto May 30, 2022
a5c934c
Merge pull request #1981 from finnishtransportagency/DROTH-3129_Probl…
reetta-kivisto May 31, 2022
763dd25
Resolved merge conflict batchSystem.yaml
anttiahopeltositowise May 31, 2022
5fc73ea
Merge pull request #1991 from finnishtransportagency/development_fix_…
anttiahopeltositowise May 31, 2022
b1d34f9
Resolved merge conflict batchSystem.yaml
anttiahopeltositowise May 31, 2022
2a26af1
Merge pull request #1992 from finnishtransportagency/master
anttiahopeltositowise May 31, 2022
a882c84
Merge pull request #1994 from finnishtransportagency/NextRelease_merg…
anttiahopeltositowise May 31, 2022
81cc8fb
Merge branch 'NextRelease' into master_into_nextRelease
anttiahopeltositowise Jun 1, 2022
f03a152
Merge branch 'master_into_nextRelease' into NextRelease_conflict_fixed
anttiahopeltositowise Jun 1, 2022
44a41bc
Merge pull request #1996 from finnishtransportagency/NextRelease_conf…
anttiahopeltositowise Jun 1, 2022
5d1623d
Merge pull request #1997 from finnishtransportagency/DROTH-3129_Probl…
reetta-kivisto Jun 1, 2022
dca1df9
DROTH-3104 Implemented Lane start date CSV import
anttiahopeltositowise Jun 3, 2022
cfc3baa
DROTH-3104 Optimized attribute update for lanes, fixed bug with roadl…
anttiahopeltositowise Jun 3, 2022
00c4e6a
Merge remote-tracking branch 'origin/DROTH-3129_Problems_with_adding_…
anttiahopeltositowise Jun 3, 2022
dff49fe
DROTH-3104 using new version of getRoadAddressToProcess
anttiahopeltositowise Jun 3, 2022
12304b8
Merge remote-tracking branch 'origin/development' into DROTH-3104_mai…
anttiahopeltositowise Jun 3, 2022
77f0a04
DROTH-3109 explicit expiration of deleted split lanes
SWJPTulijoki Jun 3, 2022
a23cd0d
DROTH-3104 fixed unit tests
anttiahopeltositowise Jun 3, 2022
e4e1551
DROTH-3109 fix one unit-test by adding sidecode
SWJPTulijoki Jun 6, 2022
9e8a735
Merge pull request #2003 from finnishtransportagency/DROTH-3109_lane_…
SWJPTulijoki Jun 7, 2022
2a73f60
Merge branch 'NextRelease' into DROTH-3104_mainlane_startdates_merge_fix
SWJPTulijoki Jun 10, 2022
9664b3c
Merge pull request #2005 from finnishtransportagency/DROTH-3104_mainl…
SWJPTulijoki Jun 10, 2022
07dc1fb
DROTH-3276 Filter out winter roads from fetched links
reetta-kivisto Jun 15, 2022
66e0fc2
DROTH-3276 Winter road tests changed to test with road link fetches
reetta-kivisto Jun 15, 2022
fb90ce7
Merge pull request #2009 from finnishtransportagency/DROTH-3276_Filte…
reetta-kivisto Jun 16, 2022
a11a3c6
DROTH-3279 fix VVH error logging
anttiahopeltositowise Jun 16, 2022
8f8d760
DROTH-3270 Add logging to APIs
reetta-kivisto Jun 16, 2022
60bb838
Merge pull request #2013 from finnishtransportagency/DROTH-3279_fix_V…
anttiahopeltositowise Jun 16, 2022
3e43d76
Merge pull request #2014 from finnishtransportagency/DROTH-3270_Impro…
reetta-kivisto Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UI/csv_import.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@

</div>

<div class="checkbox" id="csvImportLanesStartDates">
<input type="checkbox" id ="startDateCheckbox">
<label id="labelCsvImportLanesStartDatesCheckbox"><b>Päivitä vain alkupäivänmäärät</b></label>
</div>

<div class="form-group mass-transit-stop-limit">
<div class="checkbox">
<label><input type="checkbox" name="limit-import-to-roads">Rajoita CSV-tuonti maanteille</label><br />
Expand Down
31 changes: 24 additions & 7 deletions UI/newuser.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<script type="text/javascript">

var operatorCheckbox = "input[id='operatorCheckbox']";
var laneMaintainerCheckbox = "input[id='laneMaintainerCheckbox']";
var municipalityCheckbox = "input[id='municipalitiesCheckbox']";
var elysCheckbox = "input[id='elysCheckbox']";
var areasCheckbox = "input[id='areasCheckbox']";
Expand All @@ -27,11 +28,12 @@
{name: "Kaakkois-Suomi", id: 8},
{name: "Uusimaa", id: 9}];

var userSpecs =[{ role: "municipality", enabledCheckbox: [ municipalityCheckbox ], disabledCheckbox: [ operatorCheckbox, elysCheckbox, areasCheckbox] },
{ role: "ely", enabledCheckbox: [ elysCheckbox, areasCheckbox ], disabledCheckbox: [operatorCheckbox, municipalityCheckbox] },
{ role: "operator" , enabledCheckbox: [operatorCheckbox], disabledCheckbox: [ elysCheckbox, municipalityCheckbox, areasCheckbox ] },
{ role: "areas", enabledCheckbox: [ areasCheckbox, elysCheckbox ], disabledCheckbox: [ municipalityCheckbox, operatorCheckbox ] },
{ role: "default", enabledCheckbox: [ areasCheckbox, elysCheckbox, operatorCheckbox, municipalityCheckbox], disabledCheckbox: [] }];
var userSpecs =[{ role: "municipality", enabledCheckbox: [ municipalityCheckbox ], disabledCheckbox: [ laneMaintainerCheckbox,operatorCheckbox, elysCheckbox, areasCheckbox] },
{ role: "ely", enabledCheckbox: [ elysCheckbox, areasCheckbox ], disabledCheckbox: [laneMaintainerCheckbox,operatorCheckbox, municipalityCheckbox] },
{ role: "operator" , enabledCheckbox: [operatorCheckbox,laneMaintainerCheckbox], disabledCheckbox: [ laneMaintainerCheckbox,elysCheckbox, municipalityCheckbox, areasCheckbox ] },
{ role: "laneMaintainer" , enabledCheckbox: [laneMaintainerCheckbox], disabledCheckbox: [operatorCheckbox, elysCheckbox, municipalityCheckbox, areasCheckbox ] },
{ role: "areas", enabledCheckbox: [ areasCheckbox, elysCheckbox ], disabledCheckbox: [laneMaintainerCheckbox, municipalityCheckbox, operatorCheckbox ] },
{ role: "default", enabledCheckbox: [ laneMaintainerCheckbox,areasCheckbox, elysCheckbox, operatorCheckbox, municipalityCheckbox], disabledCheckbox: [] }];


function onChangeEvent() {
Expand All @@ -44,7 +46,10 @@
} else {
if ($(operatorCheckbox).is(':checked')) {
specs = _.find(userSpecs, function (spec) {return spec.role === "operator"});
} else {
} else if (($(laneMaintainerCheckbox).is(':checked'))) {
specs = _.find(userSpecs, function (spec) {return spec.role === "laneMaintainer"});
}
else {
if ($(areasCheckbox).is(':checked')) {
specs = _.find(userSpecs, function (spec) {return spec.role === "areas"});
} else {
Expand Down Expand Up @@ -102,6 +107,14 @@

}

function isLaneMaintainer() {
if($(laneMaintainerCheckbox).is(':checked'))
roleName.push('laneMaintainer');
else
delete roleName['laneMaintainer'];

}

function getMunicipalities(){
if(_.isEmpty($('.municipalities').find("#municipalities_search").find('option'))) {
if(_.isEmpty(municipalities)) {
Expand Down Expand Up @@ -214,7 +227,7 @@
}

function anyBoxChecked() {
return _.some([operatorCheckbox, municipalityCheckbox, elysCheckbox, areasCheckbox], function(checkbox){return $(checkbox).is(':checked');});
return _.some([operatorCheckbox,laneMaintainerCheckbox, municipalityCheckbox, elysCheckbox, areasCheckbox], function(checkbox){return $(checkbox).is(':checked');});
}

jQuery(document).ready(function($) {
Expand Down Expand Up @@ -332,6 +345,10 @@
<input type="checkbox" name="roleName" id = "operatorCheckbox" class="form-control" value="operator" onchange="onChangeEvent(), isOperator()">
<label class="control-label" id="labelCheckboxOperator">Operaattori</label>
</div>
<div class="checkbox">
<input type="checkbox" name="roleName" id = "laneMaintainerCheckbox" class="form-control" value="laneMaintainer" onchange="onChangeEvent(), isLaneMaintainer()">
<label class="control-label" id="labelCheckboxLaneMaintainer">Kaistat</label>
</div>

<div class="checkbox">
<input type="checkbox" id="areasCheckbox" name="roleName" value="serviceRoadMaintainer" class="form-control" onchange="onChangeEvent(), isAreaMaintenance()">
Expand Down
4 changes: 2 additions & 2 deletions UI/src/assetTypeConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,13 +1006,13 @@
title: 'Kaistan mallinnustyökalu',
newTitle: 'Uusi kaistan mallinnustyökalu',
className: 'lane-modelling-tool',
authorizationPolicy: new LinearAssetAuthorizationPolicy(),
authorizationPolicy: new LaneAssetAuthorizationPolicy(),
editControlLabels: {
title: 'Kaistan mallinnustyökalu'
},
isSeparable: false,
allowMapViewOnly: true,
allowComplementaryLinks: true,
allowComplementaryLinks: false,
allowWalkingCyclingLinks: true,
isVerifiable: false,
showValidationErrorLabel: true,
Expand Down
6 changes: 5 additions & 1 deletion UI/src/authorizationpolicies/authorizationPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
return me.isUser('operator');
};

this.isLaneMaintainer = function(){
return me.isUser('laneMaintainer');
};

this.isServiceRoadMaintainer = function(){
return me.isUser('serviceRoadMaintainer');
};
Expand All @@ -55,7 +59,7 @@
};

this.editModeAccess = function() {
return (!me.isUser('viewer') && !me.isOnlyUser('serviceRoadMaintainer'));
return (!me.isUser('viewer') && !me.isUser('laneMaintainer') && !me.isOnlyUser('serviceRoadMaintainer'));
};

this.editModeTool = function(toolType, asset, roadLink) {};
Expand Down
16 changes: 16 additions & 0 deletions UI/src/authorizationpolicies/laneAssetAuthorizationPolicy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(function(root) {
root.LaneAssetAuthorizationPolicy = function() {
AuthorizationPolicy.call(this);

var me = this;

this.formEditModeAccess = function(selectedAsset) {
return me.isStateExclusions(selectedAsset) || ( me.isLaneMaintainer() || me.isOperator() );
};

this.editModeAccess = function() {
return (!me.isUser('viewer') && me.isLaneMaintainer() || me.isOperator());
};

};
})(this);
5 changes: 1 addition & 4 deletions UI/src/controller/laneModellingCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
right.points = split.secondSplitVertices;
right.startMeasure = split.splitMeasure;

if (self.calculateMeasure(left) < self.calculateMeasure(right)) {
if (left.startMeasure < right.startMeasure) {
self.splitLinearAssets.created = left;
self.splitLinearAssets.existing = right;
} else {
Expand All @@ -53,9 +53,6 @@
self.splitLinearAssets.created.id = 0;
self.splitLinearAssets.existing.id = 0;

self.splitLinearAssets.created.marker = 'A';
self.splitLinearAssets.existing.marker = 'B';

self.dirty = true;
callback(self.splitLinearAssets);
};
Expand Down
21 changes: 15 additions & 6 deletions UI/src/csvImporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ $(function() {
$('.btn.btn-primary.btn-lg').prop('disabled', !$(this).val());
$('#deleteCheckbox').prop('disabled', !$(this).val());
$('#csvImportPoistaCheckbox').toggle($(this).val() === 'trafficSigns');
$('#csvImportLanesStartDates').toggle($(this).val() === 'lanes');
$('.mass-transit-stop-limit').toggle($(this).val() === 'massTransitStop');
}).trigger('change');

Expand Down Expand Up @@ -75,13 +76,21 @@ $(function() {
});

} else if (assetType === "lanes") {
if(($('#startDateCheckbox').is(':checked'))) {
formData.append('updateStartDates', 'true');
uploadFile();
spinnerOn();
}
else {
new GenericConfirmPopup('Huom: Kaikki vanha lisäkaistadata poistetaan, ja korvataan uudella', {
container: '.csv-content',
successCallback: function () {
uploadFile();
spinnerOn();
}
});
container: '.csv-content',
successCallback: function () {
uploadFile();
spinnerOn();
}
});
}


}else {
uploadFile();
Expand Down
14 changes: 13 additions & 1 deletion UI/src/less/core/forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,15 @@ input[type="checkbox"] {
padding-top: 0;
padding-left: 0;
}


#labelCheckboxLaneMaintainer{
width: 23%;
font-size: 12px;
line-height: 15px;
padding-top: 0;
padding-left: 0;
}

#labelCheckboxArea{
width: 61%;
font-size: 12px;
Expand Down Expand Up @@ -540,6 +548,10 @@ input[type="checkbox"] {
width: 6%;
margin-right: 18px;
}
#laneMaintainerCheckbox {
width: 6%;
margin-right: 18px;
}

#areasCheckbox {
width: 6%;
Expand Down
63 changes: 34 additions & 29 deletions UI/src/model/selectedLaneModelling.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,44 +74,42 @@
return numberOfLanesByLaneCode[key] > 1;
});

var lanesSortedByLaneCode = _.sortBy(lanes, getLaneCodeValue);

var duplicateLaneCounter = 0;
return _.map(lanesSortedByLaneCode, function (lane) {
if(_.includes(laneCodesToPutMarkers, getLaneCodeValue(lane).toString())) {
if (duplicateLaneCounter === 0){
lane.marker = 'A';
duplicateLaneCounter++;
}else{
lane.marker = 'B';
duplicateLaneCounter--;
var lanesSortedByEndMeasure = _.sortBy(lanes, function(lane) {
return lane.endMeasure;
});

_.forEach(laneCodesToPutMarkers, function (laneCode) {
var characterCounterForLaneMarker = 0;
for (var i = 0; i < lanesSortedByEndMeasure.length; i++) {
if (laneCode == getLaneCodeValue(lanesSortedByEndMeasure[i]).toString()) {
//The integer value of 'A' is 65, so every increment in the counter gives the next letter of the alphabet.
lanesSortedByEndMeasure[i].marker = String.fromCharCode(characterCounterForLaneMarker + 65);
characterCounterForLaneMarker += 1;
}
}
return lane;
});

return lanesSortedByEndMeasure;
};

//Outer lanes that are expired are to be considered, the other are updates so we need to take those out
//Here a outer lane is a lane with lane code that existed in the original but not in the modified configuration
function omitIrrelevantExpiredLanes() {
var lanesToBeRemovedFromExpire = _.filter(assetsToBeExpired, function (lane) {
return !_.isUndefined(self.getLane(getLaneCodeValue(lane)));
return !self.isOuterLane(getLaneCodeValue(lane));
});

_.forEach(lanesToBeRemovedFromExpire, function (lane) {
_.remove(assetsToBeExpired, {'id': lane.id});
});
}

self.splitLinearAsset = function(laneNumber, split) {
collection.splitLinearAsset(self.getLane(laneNumber), split, function(splitLinearAssets) {
if (self.getLane(laneNumber).id === 0) {
self.removeLane(laneNumber);
} else {
self.expireLane(laneNumber);
}

self.splitLinearAsset = function(laneNumber, split, laneMarker) {
collection.splitLinearAsset(self.getLane(laneNumber, laneMarker), split, function(splitLinearAssets) {
var laneIndex = getLaneIndex(laneNumber, laneMarker);
self.selection.splice(laneIndex,1);
self.selection.push(splitLinearAssets.created, splitLinearAssets.existing);
self.selection = giveSplitMarkers(self.selection);
self.dirty = true;
eventbus.trigger('laneModellingForm: reload');
});
Expand Down Expand Up @@ -198,18 +196,25 @@

self.lanesCutAreEqual = function() {
var laneNumbers = _.map(self.selection, getLaneCodeValue);
var cuttedLaneNumbers = _.transform(_.countBy(laneNumbers), function(result, count, value) {
var cutLaneNumbers = _.transform(_.countBy(laneNumbers), function(result, count, value) {
if (count > 1) result.push(value);
}, []);

return _.some(cuttedLaneNumbers, function (laneNumber){
return _.some(cutLaneNumbers, function (laneNumber){
var lanes = _.filter(self.selection, function (lane){
return _.find(lane.properties, function (property) {
return property.publicId == "lane_code" && _.head(property.values).value == laneNumber;
});
});

return _.isEqual(lanes[0].properties, lanes[1].properties);
var sortedLanes = _.sortBy(lanes, function (lane) {
return lane.endMeasure;
});
for (var i = 1; i < sortedLanes.length; i++) {
if (_.isEqual(sortedLanes[i - 1].properties, sortedLanes[i].properties)) {
return true;
}
}
return false;
});
};

Expand Down Expand Up @@ -255,9 +260,9 @@
sideCode: sideCode,
laneRoadAddressInfo:{
roadNumber: roadNumber,
initialRoadPartNumber: parseInt(startRoadPartNumber),
initialDistance: parseInt(startDistance),
endRoadPartNumber: parseInt(endRoadPartNumber),
startRoadPart: parseInt(startRoadPartNumber),
startDistance: parseInt(startDistance),
endRoadPart: parseInt(endRoadPartNumber),
endDistance: parseInt(endDistance),
track: track
},
Expand Down Expand Up @@ -382,7 +387,7 @@

//expiredLane could be modified by the user so we need to fetch the original
var originalExpiredLane = _.find(lanesFetched, {'id': expiredLane.id});
if (linksSelected.length > 1) {
if (linksSelected.length > 1 && _.isUndefined(marker)) {
var expiredGroup = collection.getGroup(originalExpiredLane);
expiredGroup.forEach(function (lane) {
lane.isExpired = true;
Expand Down
27 changes: 15 additions & 12 deletions UI/src/view/linear_asset/laneModellingForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
values: [
{id: 1, label: 'Pääkaista'}
]
},
{
label: 'Alkupvm', type: 'date', publicId: "start_date", weight: 13, required: true
},
{
label: 'Loppupvm', type: 'date', publicId: "end_date", weight: 14
}
]
};
Expand Down Expand Up @@ -443,23 +449,20 @@
});
});

asset = _.sortBy(asset, function (lane) {
return lane.marker;
});

var body = createBodyElement(selectedAsset.getCurrentLane());

if(selectedAsset.isSplit()) {
//Render form A
renderFormElements(_.find(asset,{'marker': 'A'}), isReadOnly, 'A', selectedAsset.setValue, selectedAsset.getValue, false, body);

if(!isReadOnly)
renderExpireAndDeleteButtonsElement(selectedAsset, body, 'A');

body.find('.form').append('<hr class="form-break">');
//Render form B
renderFormElements(_.find(asset,{'marker': 'B'}), isReadOnly, 'B', selectedAsset.setValue, selectedAsset.getValue, false, body);

if(!isReadOnly)
renderExpireAndDeleteButtonsElement(selectedAsset, body, 'B');
_.forEach(asset, function (lane) {
renderFormElements(lane, isReadOnly, lane.marker, selectedAsset.setValue, selectedAsset.getValue, false, body);
if(!isReadOnly) renderExpireAndDeleteButtonsElement(selectedAsset, body, lane.marker);
body.find('.form').append('<hr class="form-break">');
});

body.find('.form').append('<hr class="form-break">');
}else{
renderFormElements(asset[0], isReadOnly, '', selectedAsset.setValue, selectedAsset.getValue, isDisabled, body);

Expand Down
Loading