<commit_before>class MaintenanceAnnouncementsController < ApplicationController
    autocomplete :maintenance_announcement, :email

    def index
        @maintenance_announcements = MaintenanceAnnouncement.all
    end

    def show
        @maintenance_announcement = MaintenanceAnnouncement.find(params[:id])
    end

    def new
        # initialize variables for rendering new
        @machines = Machine.all
        @maintenance_templates = MaintenanceTemplate.all
        @selected_machines = Array.new
        @no_deadline = Array.new
        @no_contacts = Array.new
        @missing_vms = Array.new
        @begin_date = Time.zone.now
        @end_date = Time.zone.now + 1.hours
        @exceeded_deadlines = Array.new
        @missing_vms = Array.new
        @exceeded_deadlines = Array.new

        # selected machines if we got back here from create. map them with to_i so we can use them as integers in the template.
        @selected_machines = Machine.where(id: params[:machine_ids])

        if params[:from]
            @old_announcement = MaintenanceAnnouncement.find(params[:from])
            @selected_machines = @old_announcement.machines
            @begin_date = @old_announcement.begin_date<commit_msg>Reverse the maintenance annoucement order, newest on top.<commit_after>class MaintenanceAnnouncementsController < ApplicationController
    autocomplete :maintenance_announcement, :email

    def index
        @maintenance_announcements = MaintenanceAnnouncement.all.reverse
    end

    def show
        @maintenance_announcement = MaintenanceAnnouncement.find(params[:id])
    end

    def new
        # initialize variables for rendering new
        @machines = Machine.all
        @maintenance_templates = MaintenanceTemplate.all
        @selected_machines = Array.new
        @no_deadline = Array.new
        @no_contacts = Array.new
        @missing_vms = Array.new
        @begin_date = Time.zone.now
        @end_date = Time.zone.now + 1.hours
        @exceeded_deadlines = Array.new
        @missing_vms = Array.new
        @exceeded_deadlines = Array.new

        # selected machines if we got back here from create. map them with to_i so we can use them as integers in the template.
        @selected_machines = Machine.where(id: params[:machine_ids])

        if params[:from]
            @old_announcement = MaintenanceAnnouncement.find(params[:from])
            @selected_machines = @old_announcement.machines
            @begin_date = @old_announcement.begin_date
{'fraction_non_alphanumeric': 0.07063048683160415, 'fraction_numerical': 0.0007980845969672786, 'mean_word_length': 2.8216463414634148, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1688851', 'n_tokens_mistral': 724, 'n_tokens_neox': 680, 'n_words': 166}