<commit_before>B  = require \backbone
C  = require \../collection
Cs = require \../collections
Hv = require \../model/hive .instance
S  = require \../session
V  = require \../view
D  = require \./directive
Ui = require \./ui

M-Evi  = require \../model/evidence
M-Map  = require \../model/map
M-Note = require \../model/note

module.exports =
  edge: (id, act, child-id) ->
    done = arguments[*-1]
    fetch-entity C.Edges, id, \connection, (edge) ->
      V.edge.render edge, D.edge
      V.meta.render edge, D.meta
      render-evidences id, act, child-id
      render-notes id, act
      B.tracker.edge = edge
      done!
    false # async done
  edges: (id) ->
    done = arguments[*-1]
    fetch-default-map -> # try to show at least nodes of default map
      V.edges-head.render!
      V.edges.render C.Edges, D.edges
      done!
    false # async done
  map: (id) ->
    done = arguments[*-1]
    function show m
      V.map.map = m
      if is-sel-changed
        V.map.render!
        V.map-toolbar.reset!
        V.navbar.render!
      V.map.show!
      V.map-toolbar.show!
      V.map-info.render m, D.map
      V.map-meta.render m, D.meta
      V.map-meta.$el.find \.timeago .timeago! # async .view.finalize timeago runs too soon!
      return unless m.get-is-editable!
      return V.map-edit.render m, C.Maps, fetch:no
      V.map-edit.show!
      done!
    is-sel-changed = (not (m = V.map.map)? and not id?) or id isnt m?id
    return show m if not is-sel-changed
    return show M-Map.create! unless id?
    return Ui.show-error "Unable to get map #id" unless m = C.Maps.get id
    m.fetch success:show
    false # async done
  node: (id, act, child-id) ->
    done = arguments[*-1]
    fetch-entity C.Nodes, id, \actor, (node) -><commit_msg>fix: ensure map async calls done<commit_after>B  = require \backbone
C  = require \../collection
Cs = require \../collections
Hv = require \../model/hive .instance
S  = require \../session
V  = require \../view
D  = require \./directive
Ui = require \./ui

M-Evi  = require \../model/evidence
M-Map  = require \../model/map
M-Note = require \../model/note

module.exports =
  edge: (id, act, child-id) ->
    done = arguments[*-1]
    fetch-entity C.Edges, id, \connection, (edge) ->
      V.edge.render edge, D.edge
      V.meta.render edge, D.meta
      render-evidences id, act, child-id
      render-notes id, act
      B.tracker.edge = edge
      done!
    false # async done
  edges: (id) ->
    done = arguments[*-1]
    fetch-default-map -> # try to show at least nodes of default map
      V.edges-head.render!
      V.edges.render C.Edges, D.edges
      done!
    false # async done
  map: (id) ->
    done = arguments[*-1]
    function show m
      V.map.map = m
      if is-sel-changed
        V.map.render!
        V.map-toolbar.reset!
        V.navbar.render!
      V.map.show!
      V.map-toolbar.show!
      V.map-info.render m, D.map
      V.map-meta.render m, D.meta
      return done! unless m.get-is-editable!
      return done! V.map-edit.render m, C.Maps, fetch:no
      V.map-edit.show!
      done!
    is-sel-changed = (not (m = V.map.map)? and not id?) or id isnt m?id
    return show m if not is-sel-changed
    return show M-Map.create! unless id?
    return Ui.show-error "Unable to get map #id" unless m = C.Maps.get id
    m.fetch success:show
    false # async done
  node: (id, act, child-id) ->
    done = arguments[*-1]
    fetch-entity C.Nodes, id, \actor, (node) ->
{'fraction_non_alphanumeric': 0.14438348252959862, 'fraction_numerical': 0.002310135720473578, 'mean_word_length': 2.0466138962181177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2627227', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1224, 'n_words': 352}