Fixes + stable gateway ids
This commit is contained in:
@@ -20,7 +20,7 @@ type templateRenderer struct {
|
||||
func newTemplateRenderer(path string) (*templateRenderer, error) {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Read template: %w", err)
|
||||
return nil, fmt.Errorf("read template: %w", err)
|
||||
}
|
||||
|
||||
funcs := template.FuncMap{
|
||||
@@ -30,7 +30,7 @@ func newTemplateRenderer(path string) (*templateRenderer, error) {
|
||||
|
||||
tpl, err := template.New("acceptance").Funcs(funcs).Option("missingkey=error").Parse(string(data))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Parse template: %w", err)
|
||||
return nil, fmt.Errorf("parse template: %w", err)
|
||||
}
|
||||
|
||||
return &templateRenderer{tpl: tpl}, nil
|
||||
@@ -39,8 +39,9 @@ func newTemplateRenderer(path string) (*templateRenderer, error) {
|
||||
func (r *templateRenderer) Render(snapshot model.ActSnapshot) ([]renderer.Block, error) {
|
||||
var buf bytes.Buffer
|
||||
if err := r.tpl.Execute(&buf, snapshot); err != nil {
|
||||
return nil, fmt.Errorf("Execute template: %w", err)
|
||||
return nil, fmt.Errorf("execute template: %w", err)
|
||||
}
|
||||
|
||||
return renderer.ParseBlocks(buf.String())
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ func formatMoney(amount decimal.Decimal, currency string) string {
|
||||
if currency == "" {
|
||||
return amount.String()
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s %s", amount.String(), currency)
|
||||
}
|
||||
|
||||
@@ -56,5 +58,6 @@ func formatDate(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
return ""
|
||||
}
|
||||
|
||||
return t.Format("2006-01-02")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user