<commit_before>package controller

import (
	"bytes"
	"net/http"

	"gopkg.in/leyra/echo.v1"

	"leyra/app"
	"leyra/app/models"
)

type Blog struct {
}

type ListTemplate struct {
	Posts model.Posts
}

type ViewTemplate struct {
	Post model.Post
}

// List will list the title of each blog post with a link to then go on to view
// the title and body of it using the view template.
func (b Blog) List(c *echo.Context) error {
	buff := new(bytes.Buffer)

	db := app.S.DB

	posts := model.Posts{}
	db.Find(&posts)

	app.S.Template.ExecuteTemplate(buff, "list.html", ListTemplate{
		Posts: posts,
	})

	return c.HTML(http.StatusOK, buff.String())
}

// View displays one blog post using the :id param passed through in the URL.
// This displays both the title and body for a given post.
func (b Blog) View(c *echo.Context) error {
	db := app.S.DB

	post := model.Post{}
	db.First(&post, c.Param("id"))

	buff := new(bytes.Buffer)
	app.S.Template.ExecuteTemplate(buff, "view.html", ViewTemplate{
		Post: post,
	})

	return c.HTML(http.StatusOK, buff.String())<commit_msg>Removed 2 lines<commit_after>package controller

import (
	"bytes"
	"net/http"

	"gopkg.in/leyra/echo.v1"

	"leyra/app"
	"leyra/app/models"
)

type Blog struct {
}

type ListTemplate struct {
	Posts model.Posts
}

type ViewTemplate struct {
	Post model.Post
}

// List will list the title of each blog post with a link to then go on to view
// the title and body of it using the view template.
func (b Blog) List(c *echo.Context) error {
	buff := new(bytes.Buffer)

	posts := model.Posts{}
	app.S.DB.Find(&posts)

	app.S.Template.ExecuteTemplate(buff, "list.html", ListTemplate{
		Posts: posts,
	})

	return c.HTML(http.StatusOK, buff.String())
}

// View displays one blog post using the :id param passed through in the URL.
// This displays both the title and body for a given post.
func (b Blog) View(c *echo.Context) error {
	post := model.Post{}
	app.S.DB.First(&post, c.Param("id"))

	buff := new(bytes.Buffer)
	app.S.Template.ExecuteTemplate(buff, "view.html", ViewTemplate{
		Post: post,
	})

	return c.HTML(http.StatusOK, buff.String())
{'fraction_non_alphanumeric': 0.13459715639810427, 'fraction_numerical': 0.0014218009478672985, 'mean_word_length': 3.722595078299776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3281055', 'n_tokens_mistral': 763, 'n_tokens_neox': 733, 'n_words': 231}