<commit_before>module Juici::Controllers
  class Builds < Base

    attr_accessor :params
    def initialize(params)
      @params = params
    end

    def list
      params[:page] = params[:page] ? params[:page].to_i : 0
      pages = {}

      if params[:page] > 0
        pages[:prev] = params[:page] - 1
      end
      #if lol
      pages[:next] = params[:page] + 1
      #end

      project = ::Juici::Project.where(name: params[:project]).first
      builds  = ::Juici::Build.where(parent: project.name).
        asc(:_id).
        limit(::Juici::Config.builds_per_page).
        skip(params[:page].to_i * ::Juici::Config.builds_per_page)

      yield [:"builds/list", build_opts({:project => project, :builds => builds, :pages => pages})]
    end

    def show
      project = ::Juici::Project.where(name: params[:project]).first
      build   = ::Juici::Build.where(parent: project.name, _id: params[:id]).first<commit_msg>Get sorting the right way around<commit_after>module Juici::Controllers
  class Builds < Base

    attr_accessor :params
    def initialize(params)
      @params = params
    end

    def list
      params[:page] = params[:page] ? params[:page].to_i : 0
      pages = {}

      if params[:page] > 0
        pages[:prev] = params[:page] - 1
      end
      #if lol
      pages[:next] = params[:page] + 1
      #end

      project = ::Juici::Project.where(name: params[:project]).first
      builds  = ::Juici::Build.where(parent: project.name).
        desc(:_id).
        limit(::Juici::Config.builds_per_page).
        skip(params[:page].to_i * ::Juici::Config.builds_per_page)

      yield [:"builds/list", build_opts({:project => project, :builds => builds, :pages => pages})]
    end

    def show
      project = ::Juici::Project.where(name: params[:project]).first
      build   = ::Juici::Build.where(parent: project.name, _id: params[:id]).first
{'fraction_non_alphanumeric': 0.1569459172852598, 'fraction_numerical': 0.0042417815482502655, 'mean_word_length': 2.8353658536585367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4128407', 'n_tokens_mistral': 625, 'n_tokens_neox': 595, 'n_words': 126}