def calc_delay(remainingDrops):
    ''' Calculate the idle delay
        Minimum play time for cards to drop is ~20min again. Except for accounts
        that requested a refund?

        Re-check every 15 mintes if there are more than 1 card drops remaining.
        If only one drop remains, check every 5 minutes
    '''
    global sameDelay, lastDelay

    # Reset lastDelay for new appids
    if remainingDrops > 1:
        lastDelay = 5
        sameDelay = 0

    if remainingDrops > 2:
        return 15 * 60 # Check every 15 minutes
    elif remainingDrops == 2:
        return 10 * 60 # Check every 10 minutes
    else:
        # decrease delay by one minute every two calls
        if lastDelay > 1:
            if sameDelay == 2:
                sameDelay = 0
                lastDelay -= 1
            sameDelay += 1
        return lastDelay * 60