Skip to content

Commit

Permalink
loan calendar selector ok, accountable_repayments scope ok
Browse files Browse the repository at this point in the history
  • Loading branch information
thib44 committed Apr 27, 2017
1 parent 8acd2ea commit 11321f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/assets/javascripts/backend/loan_date.js.coffee
@@ -0,0 +1,11 @@
((E, $) ->
'use strict'
console.log('test')
$(document).ready ->
count = 0
$('#accounting_date').click ->
if count == 0
$('#accounting_date').datepicker 'option', maxDate: new Date($.now())
$('#accounting_date').datepicker 'show'
count++
) ekylibre, jQuery
2 changes: 1 addition & 1 deletion app/models/loan_repayment.rb
Expand Up @@ -58,7 +58,7 @@ class LoanRepayment < Ekylibre::Record::Base
delegate :currency, :name, to: :loan

scope :accountable_repayments, lambda { |loans_ids, input_date|
where('loan_id IN (?) AND accountable = FALSE AND due_on <= ?', loans_ids, input_date)
where('loan_id IN (?) AND accountable = FALSE AND due_on <= ? AND due_on <= ?', loans_ids, input_date, Time.zone.today)
}

before_validation do
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Expand Up @@ -42,7 +42,7 @@

config.after_initialize do
Bullet.enable = true
Bullet.alert = true
# Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
Bullet.add_footer = true
Expand Down

0 comments on commit 11321f1

Please sign in to comment.