Finished assono-backup-nexttape
This commit is contained in:
@@ -1,25 +1,24 @@
|
||||
export def lumen-assono-backup-nexttape [dateinput: datetime]: nothing -> nothing {
|
||||
$dateinput | get-backup-string
|
||||
print 'Next Required Tape:'
|
||||
print $'($dateinput | get-backup-string)'
|
||||
print ''
|
||||
print 'Tapes after that:'
|
||||
|
||||
..9 | each {|i|
|
||||
1..9 | each {|i|
|
||||
print $'($i): (($dateinput + ((7 * $i) | into duration -u day)) | get-backup-string)'
|
||||
}
|
||||
} | ignore
|
||||
}
|
||||
|
||||
def get-backup-string []: datetime -> string {
|
||||
print $in
|
||||
let saturdayOfMonth = $in | get-week-of-month 6
|
||||
let monthOfQuarter = $in | get-month-of-quarter
|
||||
let quarter = $in | get-quarter
|
||||
let year = $in | get-year
|
||||
let backupDay = $in - ($in | format date '%w' | into duration -u day) + 6day
|
||||
let saturdayOfMonth = $backupDay | get-week-of-month
|
||||
let monthOfQuarter = $backupDay | get-month-of-quarter
|
||||
let quarter = $backupDay | get-quarter
|
||||
let year = $backupDay | get-year
|
||||
if ($saturdayOfMonth == 1) {
|
||||
if ($monthOfQuarter == 1) {
|
||||
if ($quarter == 1) {
|
||||
$'TapeLTO5-Y($year)'
|
||||
$'TapeLTO5-Y(($year | into string | str substring 3..))'
|
||||
} else {
|
||||
$'TapeLTO5-Q($quarter)'
|
||||
}
|
||||
@@ -31,8 +30,10 @@ def get-backup-string []: datetime -> string {
|
||||
}
|
||||
}
|
||||
|
||||
def get-week-of-month [weekdayindex: int]: datetime -> int {
|
||||
($in + ($weekdayindex | into duration -u day) - (($in | format date '%w' ) | into duration -u day)) | format date %w
|
||||
def get-week-of-month []: datetime -> int {
|
||||
let firstDay = ($in - ($in | format date '%d' | into duration -u day) + 1day)
|
||||
let $firstSpecificDay = $firstDay + (((($in | format date '%w' | into int) + 7 - ($firstDay | format date '%w' | into int)) mod 7) | into duration -u day)
|
||||
((($in - $firstSpecificDay) | into int | into datetime | format date '%d' | into int) / 7 | math floor) + 1
|
||||
}
|
||||
|
||||
def get-month-of-quarter []: datetime -> int {
|
||||
|
||||
Reference in New Issue
Block a user