git ssb

0+

Piet / ssb-loomio



Commit 15faa252573d24fb834a5b13c7db4411cf2edb21

Little refactor.

Piet Geursen committed on 5/10/2018, 10:02:18 PM
Parent: 09ff6ff75629cd4e5197bc32d8146ad5abfdc179

Files changed

poll/async/get.jschanged
poll/async/get.jsView
@@ -83,21 +83,25 @@
8383 }, cb)
8484 }
8585 }
8686
87+ function doesMsgRefPoll (msg) {
88+ return msg.value.content.root === poll.key
89+ }
90+
8791 // TODO add missingContext warnings to each msg
8892 msgs = sort(msgs)
8993
9094 const latestClosingTime = msgs
91- .filter(msg => msg.value.content.root === poll.key)
95+ .filter(doesMsgRefPoll)
9296 .filter(isPollUpdate)
9397 .map(msg => parsePollUpdate(msg).closesAt)
9498 .pop()
9599
96100 if (latestClosingTime) poll.closesAt = latestClosingTime
97101
98102 poll.positions = msgs
99- .filter(msg => msg.value.content.root === poll.key)
103+ .filter(doesMsgRefPoll)
100104 .filter(isPosition[type])
101105 .map(position => {
102106 return decoratePosition({position, poll})
103107 })
@@ -108,9 +112,9 @@
108112 return a.value.timestamp > b.value.timestamp ? -1 : +1
109113 })[0]
110114
111115 poll.errors = msgs
112- .filter(msg => msg.value.content.root === poll.key)
116+ .filter(doesMsgRefPoll)
113117 .filter(msg => isPosition(msg) && !isPosition[type](msg))
114118 .map(position => {
115119 return {
116120 type: ERROR_POSITION_TYPE,

Built with git-ssb-web