Skip to content

Instantly share code, notes, and snippets.

{ styles } = require 'helpers'
PayoffOverview = require 'views/accounts/payoff/overview'
module.exports = class PayoffWindow extends Backbone.TitaniumView
viewName: 'Window'
attributes: styles.window.main
# Uses 101 (also known as n + 1 where n = 100) queries
mergeTransactionsBad: ->
all_transactions = []
te_transactions = db.run "select * from te_transactions where member_id=1 order by posted_at DESC limit 100"
for transaction in te_transactions
network_transaction = db.run "select * from network_transactions where transaction_id=#{transaction.id}"
transaction.member_id = network_transaction.id
def within_box_or_near(location_class, box, center)
box.present? ? location_class.within_box(box) : location_class.near(center)
end
def filter(params)
locations = {}
within_box_or_near(Location.class_for_provider(services.shift), @box, @center).each do |location|
locations[location.loc_hash] = location
@model.comments.fetch
success: =>
commentListView = new CommentListView
collection: @model.comments
fetchOnInit: false
title: 'All comments'
$(@el).append commentListView.render().el