make getters immutable

This commit is contained in:
timurgordon
2025-02-20 06:38:42 +03:00
parent 814b61f25e
commit 0704c9421d
2 changed files with 7 additions and 7 deletions

View File

@@ -202,7 +202,7 @@ pub fn (s Sheet) tosmaller(args_ ToYearQuarterArgs) !&Sheet {
// tagsfilter []string
// tags if set will see that there is at least one corresponding tag per row
// rawsfilter is list of names of rows which will be included
pub fn (mut s Sheet) toyear(args ToYearQuarterArgs) !&Sheet {
pub fn (s Sheet) toyear(args ToYearQuarterArgs) !&Sheet {
mut args2 := args
args2.period_months = 12
return s.tosmaller(args2)
@@ -215,7 +215,7 @@ pub fn (mut s Sheet) toyear(args ToYearQuarterArgs) !&Sheet {
// tagsfilter []string
// tags if set will see that there is at least one corresponding tag per row
// rawsfilter is list of names of rows which will be included
pub fn (mut s Sheet) toquarter(args ToYearQuarterArgs) !&Sheet {
pub fn (s Sheet) toquarter(args ToYearQuarterArgs) !&Sheet {
mut args2 := args
args2.period_months = 3
return s.tosmaller(args2)

View File

@@ -71,19 +71,19 @@ pub fn (s Sheet) rowname_get(args RowGetArgs) !string {
}
// return e.g. "'Y1', 'Y2', 'Y3', 'Y4', 'Y5', 'Y6'" if year, is for header
pub fn (mut s Sheet) header_get_as_list(period_type PeriodType) ![]string {
pub fn (s Sheet) header_get_as_list(period_type PeriodType) ![]string {
str := s.header_get_as_string(period_type)!
return str.split(',')
}
// return e.g. "'Y1', 'Y2', 'Y3', 'Y4', 'Y5', 'Y6'" if year, is for header
pub fn (mut s Sheet) data_get_as_list(args RowGetArgs) ![]string {
pub fn (s Sheet) data_get_as_list(args RowGetArgs) ![]string {
str := s.data_get_as_string(args)!
return str.split(',')
}
// return e.g. "'Y1', 'Y2', 'Y3', 'Y4', 'Y5', 'Y6'" if year, is for header
pub fn (mut s Sheet) header_get_as_string(period_type PeriodType) !string {
pub fn (s Sheet) header_get_as_string(period_type PeriodType) !string {
err_pre := "Can't get header for sheet:${s.name}\n"
nryears := int(s.nrcol / 12)
mut out := ''
@@ -112,7 +112,7 @@ pub fn (mut s Sheet) header_get_as_string(period_type PeriodType) !string {
}
// return the values
pub fn (mut s Sheet) data_get_as_string(args RowGetArgs) !string {
pub fn (s Sheet) data_get_as_string(args RowGetArgs) !string {
if args.rowname == '' {
return error('rowname needs to be specified')
}
@@ -166,7 +166,7 @@ pub fn (mut s Sheet) data_get_as_string(args RowGetArgs) !string {
}
// use RowGetArgs to get to smaller version of sheet
pub fn (mut s Sheet) filter(args RowGetArgs) !&Sheet {
pub fn (s Sheet) filter(args RowGetArgs) !&Sheet {
period_months := match args.period_type {
.year { 12 }
.month { 1 }