diff --git a/features/car/conditional_restrictions.feature b/features/car/conditional_restrictions.feature index c2311067c..deb5178f0 100644 --- a/features/car/conditional_restrictions.feature +++ b/features/car/conditional_restrictions.feature @@ -353,6 +353,18 @@ Feature: Car - Turn restrictions | b | a | bj,jc,jc,aj,aj | | b | d | bj,jd,jd | + # here we check that conditional restrictions can be updated via re-run of `contract`/`customize` with updated `--parse-conditionals-from-now` + # 10am utc, sat + When I run "osrm-contract {osm_file} --time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1494064800" + When I run "osrm-customize {osm_file} --time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1494064800" + + When I route I should get + | from | to | route | + | b | c | bj,jc,jc | + | b | a | bj,aj,aj | + | b | d | bj,jd,jd | + + @no_turning @conditionals Scenario: Car - Conditional restriction with multiple time windows Given the extract extra arguments "--parse-conditional-restrictions" diff --git a/src/updater/updater.cpp b/src/updater/updater.cpp index 9301c804b..e24468fe7 100644 --- a/src/updater/updater.cpp +++ b/src/updater/updater.cpp @@ -583,8 +583,15 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &e [&] { extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data); }, [&] { - extractor::files::readTurnWeightPenalty( - config.GetPath(".osrm.turn_weight_penalties"), turn_weight_penalties); + // we are going to overwrite this `.turn_weight_penalties` afterwards, + // so here we backup the original turn penalties if we didn't do that yet in order to + // guarantee that subsequent runs of this code will work on top of original weights + auto path = config.GetPath(".osrm.turn_weight_penalties").string() + ".original"; + if (!boost::filesystem::exists(path)) + { + boost::filesystem::copy_file(config.GetPath(".osrm.turn_weight_penalties"), path); + } + extractor::files::readTurnWeightPenalty(path, turn_weight_penalties); }, [&] { extractor::files::readTurnDurationPenalty(