1. Ruby / Говнокод #1687

    −95.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    @ids.each_index do |di|
            if @ids[di] then
              @ids[di].each_index do |li|
                @employ[di][li] = Hash.new
                @employ[di][li][:subject] = Subject.find(:first, :conditions => "id = #{
                  Lesson.find(:first, :conditions => "id = #{@ids[di][li]}")[:subject_id]
                 }")[:title] if @ids[di][li]
                @employ[di][li][:class] = SchoolClass.find(:first, :conditions => "id = #{
                  Lesson.find(:first, :conditions => "id = #{@ids[di][li]}")[:school_class_id]
                 }")[:number].to_s +
                  SchoolClass.find(:first, :conditions => "id = #{
                  Lesson.find(:first, :conditions => "id = #{@ids[di][li]}")[:school_class_id]
                 }")[:letter] if @ids[di][li]
                @employ[di][li][:teacher] = Teacher.find(:first, :conditions => "id = #{
                  Lesson.find(:first, :conditions => "id = #{@ids[di][li]}")[:teacher_id]
                 }")[:name] + ' ' +
                  @employ[di][li][:teacher] = Teacher.find(:first, :conditions => "id = #{
                  Lesson.find(:first, :conditions => "id = #{@ids[di][li]}")[:teacher_id]
                 }")[:surname] + ' ' +
                  @employ[di][li][:teacher] = Teacher.find(:first, :conditions => "id = #{
                  Lesson.find(:first, :conditions => "id = #{@ids[di][li]}")[:teacher_id]
                 }")[:patronymic] if @ids[di][li]
              end
            end
          end

    Небольшая утренняя ревизия кода раскрыла заговор по свержению власти и захвату мозга остальных кодеров проекта.

    Сидим, рефакторим.

    Запостил: eveel, 26 Августа 2009

    Комментарии (10) RSS

    Добавить комментарий