module MonthlyQuotaPace

Overview

Check a monthly quota you set against the daily sends you list. Everything is arithmetic on your numbers: the tool reads no clock (today comes from --today), calls no service and knows no vendor's rules.

Defined in:

monthly_quota_pace.cr

Constant Summary

REQUIRED = ["day", "sent"] of ::String
USAGE = "usage: monthly-quota-pace sends.csv --quota 5000 --month 2026-11 --today 2026-11-18\nCSV columns: day (yyyy-mm-dd), sent (whole number). The quota is set by you; the tool reads no clock and knows no vendor's rules. More: https://www.onegtmlab.dev/tool-directory/sending/emailbison"
VERSION = "1.0.0"

Class Method Summary

Class Method Detail

def self.cli(args : Array(String), stdout : IO, stderr : IO) : Int32 #

Command line entry. Returns the exit code: 0 ok, 1 bad input or file, 2 usage.


[View source]
def self.days_in_month(year : Int32, month : Int32) : Int32 #

[View source]
def self.fmt1(num : Int128, den : Int128) : String #

num / den as text with 1 decimal, rounded half away from zero. num must not be negative and den must be above 0.


[View source]
def self.leap_year?(year : Int32) : Bool #

[View source]
def self.pace(entries : Array(Entry), month : Month, quota : Int64, today : Int32) : Pace #

today is the day of the month of --today and must lie in the month.


[View source]
def self.parse_csv(text : String) : Array(Array(String)) #

Small CSV reader: comma separated, double quoted fields may hold commas, line breaks and "" for a quote mark. Returns rows of raw cell strings.


[View source]
def self.parse_date(text : String) : Tuple(Int32, Int32, Int32) | Nil #

yyyy-mm-dd only; returns year, month, day or nil when it is not a real date.


[View source]
def self.parse_month(text : String) : Month #

[View source]
def self.read_entries(text : String) : Array(Entry) #

Reads the day and sent columns. The header counts as row 1.


[View source]
def self.render(p : Pace) : String #

[View source]