Merge pull request #601 from metamaps/fix/nil-mapping-export
I think this fixes issue #566 but I'm not sure
This commit is contained in:
commit
15ca43d49f
1 changed files with 4 additions and 2 deletions
|
@ -35,6 +35,7 @@ class MapExportService < Struct.new(:user, :map)
|
|||
.where(mappable: visible_topics, map: map)
|
||||
topic_mappings.map do |mapping|
|
||||
topic = mapping.mappable
|
||||
next nil if topic.nil?
|
||||
OpenStruct.new(
|
||||
id: topic.id,
|
||||
name: topic.name,
|
||||
|
@ -46,12 +47,13 @@ class MapExportService < Struct.new(:user, :map)
|
|||
user: topic.user.name,
|
||||
permission: topic.permission
|
||||
)
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
def exportable_synapses
|
||||
visible_synapses = Pundit.policy_scope!(user, map.synapses)
|
||||
visible_synapses.map do |synapse|
|
||||
next nil if synapse.nil?
|
||||
OpenStruct.new(
|
||||
topic1: synapse.node1_id,
|
||||
topic2: synapse.node2_id,
|
||||
|
@ -60,7 +62,7 @@ class MapExportService < Struct.new(:user, :map)
|
|||
user: synapse.user.name,
|
||||
permission: synapse.permission
|
||||
)
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
def to_spreadsheet
|
||||
|
|
Loading…
Reference in a new issue