<commit_before># Leap - Electronic Individual Learning Plan Software
# Copyright (C) 2011 South Devon College

# Leap is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# Leap is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with Leap.  If not, see <http://www.gnu.org/licenses/>.

class Admin::SettingsController < ApplicationController

  skip_before_filter :maintenance_mode
  before_filter :admin_only
  layout "admin"

  def index
    @settings = Settings.defaults.keys.sort
  end

  def create
    Settings.defaults.keys.each do |k|
      if params[k] 
        Settings[k] = params[k]
      end
    end
    redirect_to admin_settings_url
  end

end
<commit_msg>Make it so you can actually pass a hash through for disc levels from admin settings.<commit_after># Leap - Electronic Individual Learning Plan Software
# Copyright (C) 2011 South Devon College

# Leap is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# Leap is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with Leap.  If not, see <http://www.gnu.org/licenses/>.

class Admin::SettingsController < ApplicationController

  skip_before_filter :maintenance_mode
  before_filter :admin_only
  layout "admin"

  def index
    @settings = Settings.defaults.keys.sort
  end

  def create
    Settings.defaults.keys.each do |k|
      if params[k] 
        # TODO: I know this is rubbish, but it's the best way, for now, of getting hashes done in
        # the rough and ready admin settings I have. I need a better way of doing this stuff.
        if k == "disciplinary_levels"
          Settings[k] = eval params[k]
        else
          Settings[k] = params[k]
        end
      end
    end
    redirect_to admin_settings_url
  end

end

{'fraction_non_alphanumeric': 0.056891943489881636, 'fraction_numerical': 0.0038182512409316535, 'mean_word_length': 3.440677966101695, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7579279', 'n_tokens_mistral': 713, 'n_tokens_neox': 682, 'n_words': 340}