nutella_framework 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1bf6f63a4b7563e6e7028cfd8936e5df9f53821
4
- data.tar.gz: d7c755b5a49b11d1e951d126175480ba5923fb43
3
+ metadata.gz: 336e963e13e64d739fa308d9360702ee7a99ec00
4
+ data.tar.gz: cfb3eec4d18fad99d29775dbdc7fbf91125de781
5
5
  SHA512:
6
- metadata.gz: 64b1028579522633d0bd28e0e69205930c8d82abd42eb597e20123bd1984ae2030021259ed6b234780278ba09ce1718a74f1ed27892fd378c06086a48a7345d6
7
- data.tar.gz: 2359ce26c61a9434515d621075fa63d82740499484c419c9691c9d385d3f8a8582586fc40215737f075b5057593eeec70c60cd1acf4c95dbbcce4335da67e0a5
6
+ metadata.gz: eada9bf3f7037349157cb9457e1040d807107f8a9de3bae65b573ec9487f243554067add643bc550914b761ac8c281411a256dcd08469d7951b05456bca4ef4a
7
+ data.tar.gz: 417f90ea2382fb8318d6a58799c78ec54365b68a8ca114b9cd494962ef9728970be7768493699376de877a6311b17b304bd8a55db30e105ed4b6b08eeeb9b877
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
@@ -129,7 +129,10 @@ nutella.f.net.subscribe_to_all_runs('channels/update', lambda do |message, app_i
129
129
  channels_db['channels'] = new_channels
130
130
  end
131
131
 
132
- # Notify Update
132
+ # Clean configs to remove deleted channels + Notify configs update
133
+ clean_configs(app_id, run_id)
134
+
135
+ # Notify channels Update
133
136
  publish_channels_update(app_id, run_id, new_channels)
134
137
  end)
135
138
 
@@ -170,6 +173,34 @@ def publish_channels_update(app_id, run_id, channels)
170
173
  nutella.f.net.publish_to_run(app_id, run_id, 'channels/updated', channels)
171
174
  end
172
175
 
176
+ # Removes deleted channels ids from configs and notifies
177
+ def clean_configs(app_id, run_id)
178
+ configs_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'configs')
179
+ new_configs = configs_db.dup
180
+
181
+ channels_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'channels')
182
+ ids = []
183
+ channels_db['channels'].each do |k, channel|
184
+ ids << k
185
+ end
186
+
187
+ o = {}
188
+ new_configs['configs'].each do |key, config|
189
+ config = new_configs['configs'][key]
190
+ config['mapping'].each do |mapping|
191
+ mapping['items'].each do |item|
192
+ item['channels'] = item['channels'] & ids # intersection of channels
193
+ #p item['channels']
194
+ end
195
+ end
196
+ o[key] = config
197
+ end
198
+ #new_configs['configs'] = c
199
+ configs_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'configs')
200
+ configs_db['configs'] = o.dup
201
+ publish_configs_update(app_id, run_id, o.dup)
202
+ end
203
+
173
204
  ################ RoomCast API ################
174
205
 
175
206
  # Returns the name of the current running activity