<commit_before>package server

import (
	log "github.com/Sirupsen/logrus"
	"github.com/casey-chow/tigertrade/server/models"
	"github.com/getsentry/raven-go"
	"github.com/julienschmidt/httprouter"
	"net/http"
	"strconv"
)

// ReadSeeks performs a customizable request defined by r for a collection of seeks, and writes them to w
func ReadSeeks(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
	query := models.NewSeekQuery()

	// Get limit from params
	if limit, err := strconv.ParseUint(r.URL.Query().Get("limit"), 10, 64); err == nil && limit != 0 {
		query.Limit = limit
	}

	query.OnlyMine, _ = strconv.ParseBool(r.URL.Query().Get("isMine"))

	if offset, err := strconv.ParseUint(r.URL.Query().Get("offset"), 10, 64); err == nil {
		query.Offset = offset
	}

	// Get User ID if we happen to be logged in
	if user, err := models.GetUser(db, getUsername(r)); err == nil {
		query.UserID = user.KeyID
	}

	// Get optional search query from params
	query.Query = r.URL.Query().Get("query")<commit_msg>Same change to seeks<commit_after>package server

import (
	log "github.com/Sirupsen/logrus"
	"github.com/casey-chow/tigertrade/server/models"
	"github.com/getsentry/raven-go"
	"github.com/julienschmidt/httprouter"
	"net/http"
	"strconv"
)

// ReadSeeks performs a customizable request defined by r for a collection of seeks, and writes them to w
func ReadSeeks(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
	query := models.NewSeekQuery()

	// Get limit from params
	if limit, err := strconv.ParseUint(r.URL.Query().Get("limit"), 10, 64); err == nil && limit != 0 {
		query.Limit = limit
	}

	query.OnlyMine, _ = strconv.ParseBool(r.URL.Query().Get("isMine"))

	if offset, err := strconv.ParseUint(r.URL.Query().Get("offset"), 10, 64); err == nil {
		query.Offset = offset
	}

	// Get User ID if we happen to be logged in (if necessary)
	// getUsername makes a network call every time to see if the user is
	// still authenticated with CAS, so it should only be used when necessary.
	if query.OnlyMine {
		if user, err := models.GetUser(db, getUsername(r)); err == nil {
			query.UserID = user.KeyID
		}
	}

	// Get optional search query from params
	query.Query = r.URL.Query().Get("query")
{'fraction_non_alphanumeric': 0.14157303370786517, 'fraction_numerical': 0.008089887640449439, 'mean_word_length': 3.924778761061947, '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': '4961876', 'n_tokens_mistral': 800, 'n_tokens_neox': 762, 'n_words': 215}