Skip to content

Comments

Update tasks.py#2

Open
zeref02 wants to merge 1 commit intomasterfrom
Biozid02-patch-2
Open

Update tasks.py#2
zeref02 wants to merge 1 commit intomasterfrom
Biozid02-patch-2

Conversation

@zeref02
Copy link
Owner

@zeref02 zeref02 commented Nov 17, 2015

  def get_overdue(loan_period):
  # check for overdue articles
  today = nowdate()

overdue_by_member = {}
articles_transacted = []

for d in frappe.db.sql("""select name, article, article_name, library_member, member_name
    from `tabLibrary Transaction` order by transaction_date desc, modified desc""", as_dict=1):

    if d.article in articles_transacted:
        continue

    if d.transaction_type=="Issue" and date_diff(today, d.transaction_date) > loan_period:
        overdue_by_member.setdefault(d.library_member, [])
        overdue_by_member[d.library_member].append(d)

    articles_transacted.append(d.article)

In the given code query didn't include the "transaction_date" too. I missed that in the previous pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants