Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/04/21 17:04:01 (2 years ago)
Author:
dpiringe
Message:

#3026

  • added the dockerhub readme file
  • fixed a bug which caused changed values (changed by events) to be overwritten with wrong values
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs

    r18059 r18077  
    107107        var rcModifierItem = JsonItemConverter.Extract(rcModifier);
    108108
    109         foreach (JObject param in parameters) {
    110           var path = param[nameof(IJsonItem.Path)].ToString();
    111           foreach (var item in rcModifierItem)
    112             if (item.Path == path)
    113               item.SetJObject(param);
    114         }
     109        SetJObjects(rcModifierItem, parameters);       
    115110
    116111        JsonItemConverter.Inject(rcModifier, rcModifierItem);
     
    124119      Objects.Add(root.Path, root);
    125120
    126       foreach (JObject obj in Template[Constants.Parameters]) {
    127         string path = obj.Property(nameof(IJsonItem.Path)).Value.ToString();
    128         foreach(var tmp in root) {
    129           if(tmp.Path == path) {
    130             tmp.SetJObject(obj);
    131             Objects.Add(tmp.Path, tmp);
     121      foreach (var kvp in SetJObjects(root, Template[Constants.Parameters]))
     122        Objects.Add(kvp);
     123    }
     124
     125    private IDictionary<string, IJsonItem> SetJObjects(IJsonItem root, JToken parameters) {
     126      var dict = new Dictionary<string, IJsonItem>();
     127      foreach (JObject obj in parameters) {
     128        var path = obj[nameof(IJsonItem.Path)].ToString();
     129        foreach (var item in root) {
     130          if (item.Path == path) {
     131            item.SetJObject(obj);
     132            item.Active = true;
     133            dict.Add(item.Path, item);
    132134          }
    133135        }
    134136      }
     137      return dict;
    135138    }
    136    
     139
    137140    private void MergeTemplateWithConfig() {
    138141      foreach (JObject obj in Config) {
Note: See TracChangeset for help on using the changeset viewer.