Uploaded image for project: 'mod-circulation'
  1. mod-circulation
  2. CIRC-548

(1-OD-B-1) Calculate intervals between due-date and returned/renewed-date



    • Template:
    • Sprint:
      EPAM-Veg Sprint 31, EPAM-Veg Sprint 32, EPAM-Veg Sprint 33
    • Story Points:
    • Development Team:


      To see how this JIRA issue integrates with the other overdue fine JIRA issues please see the diagram at https://drive.google.com/file/d/1uzezgYpgZ8XiSmSdqC2fntda1HomjbP-/view?usp=sharing


      Purpose: Module to calculate number of minutes an item is returned or renewed late, considering the grace period and/or closed hours if an institution has elected to have one or both considered. Initially this process will be used by the overdue fine calculation process (CIRC-524) and automated patron block determination process (UIU-1168).

      From Loan record

      • Due date
      • Loan policy (need to know applied Loan policy in order to access Grace period)
      • Overdue fine policy (need to know applied Overdue fine policy in order to access Count closed days/hours/minutes and Ignore grace periods for recalls (newly added, see attached screen mock-up Automated Overdue Fines - Loan Details Changes.png)
      • dueDateChangedByRecall (this is an existing back-end flag that is not displayed in the UI)

      From Loan Policy record

      • Grace period
      • Loan period

      From Overdue Fine Policy record

      • Count closed days/hours/minutes
      • Ignore grace periods for recalls

      Also Library Calendar, which is established at Settings>Calendar, to see when library is opened/closed


      • overdueMinutes

      Processing Considerations:

      • Does library have a grace period? (A grace period is a short period of time after the due date during with the library allows the item to be returned with charging an overdue fine.)
      • Does library count closed days? (Libraries may elect to include the minutes/hours/days they are closed as part of the overdue calculation. If they don't, the library's calendar must be used to determine if/when the library was opened for each day the item was overdue.)
      • Is returned item the result of a recall? (Items that are requested by other patrons while they are checked out are called recalls. The patron who currently has the item checked out is given a certain amount of time to return the book. The institution may ignore the grace period for a recalled item.)


      Important Note

      The smallest allowable interval is minutes, so the best approach is to convert everything to minutes for the calculations, then convert back to hours, days, weeks or month as needed.

      Convert Grace period into minutes

      • If dueDateChangedByRecall (from Loan record) = "true" and Ignore grace periods for recalls (from Overdue Loan Policy) = "Yes" <=====means the item has been recalled, and grace periods are not considered for recalled items
        • Set minutesGracePeriod = 0
      • Else
        • If Grace period (from Loan Policy) is > 0
          • If Grace period interval = Hour(s)
            • Set minutesGracePeriod = Grace period * 60
          • Else if Grace period interval = Day(s)
            • Set minutesGracePeriod = Grace period * 1440
          • Else if Grace period interval = Week(s)
            • Set minutesGracePeriod = Grace period * 10080
          • Else if Grace period interval = Month(s)
            • Set minutesGracePeriod = Grace period * 44640
          • Else
            • Set minutesGracePeriod = Grace period <=====means the grace period is already in minutes
        • Else
          • Set minutesGracePeriod = 0 <=====means there is no grace period

      Calculate overdueMinutes, which is the total minutes between Due date and current System Date/Time

      • If Count closed days/hours/minutes (from Overdue Fine Policy) = "No" <=====means the institution has elected to use the actual time that has passed, regardless of the hours they have been opened
        • Set overdueMinutes to total minutes between Due date (from Loan record) and current System Date/Time
      • Else
        • Access Library Calendar to set overdueMinutes to total open minutes between Due date (from Loan record) and current System Date/Time <=====means the institution only wants to count the time they have been open

      Determine if overdueMinutes extend beyond the allowable Grace period (minutesGracePeriod)

      • If overdueMinutes > minutesGracePeriod
        • Do nothing else
      • Else
        • Set overdueMinutes = 0 <=====means the item was returned late, but it was within the institution's grace period

        TestRail: Results


            Issue Links



                OleksandrVidinieiev Oleksandr Vidinieiev
                hollyolepm Holly Mistlebauer
                Tester Assignee:
                Holly Mistlebauer Holly Mistlebauer
                0 Vote for this issue
                5 Start watching this issue



                    TestRail: Runs

                      TestRail: Cases