Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% estudiantes = (@seccion || @materia.clase).estudiante_clases.includes(:periodo_lectivo).order_apellido %>
- <% titulo('Hoja de calificaciones') %>
- <script type="text/javascript">
- $(function() {
- $t_cont = $("#t_cont");
- $t_izq = $("#t_izq");
- $t_der = $("#t_der");
- $t_calificaciones = $("#calificaciones");
- $t_cabecera = $("#t_cabecera");
- $t_cabecera1 = $("#t_cabecera1")
- ancho_izquierda = $t_izq.width();
- /* ocultar Loading y mostrar tabla */
- $("#t_loading").hide();
- $t_cont.show();
- /* slide horizontal */
- hslider = $("#hslider").slider({
- slide: function(event,ui){
- $t_calificaciones.css('marginLeft',(ui.value*-1));
- $t_cabecera.css('marginLeft',(ui.value*-1));
- }
- });
- reset_slider(hslider);
- /* resize wide*/
- $("#clayout").click(function(){ reset_slider(hslider); });
- function reset_slider(rslider){
- $t_calificaciones.css('marginLeft',ancho_izquierda);
- $t_cabecera.css('marginLeft',ancho_izquierda);
- rslider.slider("option","value",ancho_izquierda*-1);
- rslider.slider("option","min",ancho_izquierda*-1);
- rslider.slider("option","max", $t_der.width()-($t_cont.width()+ancho_izquierda) );
- }
- /* fix header */
- pos_inicial = $t_cabecera.offset().top - 25;
- $(window).scroll(function(){
- if (window.pageYOffset > pos_inicial) {
- $t_cabecera.css('top',window.pageYOffset-pos_inicial);
- $t_cabecera1.css('top',window.pageYOffset-pos_inicial);
- }
- else {
- $t_cabecera.css('top',0);
- $t_cabecera1.css('top',0);
- }
- });
- });
- </script>
- <div class="detalle bloque">
- <p>
- <b>Materia:</b>
- <%= @materia.nombre %>
- </p>
- <p>
- <b>Clase:</b>
- <%= (@seccion || @materia.clase).nombre_completo %>
- </p>
- </div>
- <div id="t_loading"> Generando tabla </div>
- <div class="t_cont" id="t_cont">
- <div class="t_izq" id="t_izq">
- <table id="t_cabecera1" class="t_cabecera">
- <thead>
- <tr>
- <th class="tnum">#</th>
- <th class="tmat">Materia</th>
- </tr>
- <tr>
- <th> </th>
- <th> </th>
- </tr>
- </thead>
- </table>
- <table>
- <thead>
- <tr class="t_virtual">
- <th> </th>
- <th> </th>
- </tr>
- </thead>
- <% i = 0; %>
- <tbody>
- <% estudiantes.each do |e| %>
- <tr>
- <td class="tnum"><%= i += 1 if e.retirado.nil? %></td>
- <td class="tmat"><%= e.estudiante.apellido_corto %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
- <div class="t_der" id="t_der">
- <table id="t_cabecera" class="t_cabecera">
- <thead>
- <tr>
- <% numcols = 0 %>
- <% @hoja[:head].each_with_index do |h, p| %>
- <% next if h.nil? %>
- <th class="periodo" colspan="<%= h[:cols] %>">
- <%= "#{Clase.nombre_grado(p + 1)} #{@materia.periodo_lectivo.last_tipo_nota.try(:nombre) || 'PerÃodo'}" %>
- </th>
- <% numcols += h[:cols] %>
- <% end %>
- <th rowspan="2" class="tooltip tot" data-tooltip="Promedio estudiante">PR</th>
- </tr>
- <tr class="titulo_acumulado">
- <% @hoja[:head].each_with_index do |h, p| %>
- <% next if h.nil? %>
- <% h[:eval].times do |i| %>
- <th class="tooltip eval" data-tooltip="<%= Clase.nombre_grado(i + 1) %> Acumulado"><%= i + 1 %>A</th>
- <% end %>
- <% if h[:acum] > 0 %>
- <th class="tooltip acum <%= 'last' if h[:eval] + 1 == h[:cols] %>"
- data-tooltip="Total Acumulado">TA</th>
- <% end %>
- <% if h[:exam] > 0 %>
- <th class="tooltip exam <%= 'last' if h[:eval] + h[:acum] + 1 == h[:cols] %>"
- data-tooltip="Examen">EX</th>
- <% end %>
- <% c = @materia.periodo_lectivo.last_tipo_nota; h[:cons].times do |i| %>
- <th class="tooltip cons <%= 'last' if h[:eval] + h[:acum] + h[:exam] + i + 1 == h[:cols] %>"
- data-tooltip="<%= "#{Clase.nombre_grado(c.try(:numero_consolidado, p + 1))} " \
- "#{c.try(:nombre) || 'PerÃodo'}" %>">
- <%= "#{c.try(:numero_consolidado, p + 1)}#{c.try(:nombre_corto) || 'P'}" %>
- </th>
- <% c = c.try(:consolidado) %>
- <% end %>
- <% end %>
- </tr>
- </thead>
- </table>
- <table class="calificaciones" id="calificaciones">
- <thead>
- <tr class="t_virtual">
- <% @hoja[:head].each_with_index do |h, p| %>
- <% next if h.nil? %>
- <% h[:eval].times do |i| %>
- <th class="eval"> </th>
- <% end %>
- <% if h[:acum] > 0 %>
- <th class="acum"> </th>
- <% end %>
- <% if h[:exam] > 0 %>
- <th class="exam"> </th>
- <% end %>
- <% c = @materia.periodo_lectivo.last_tipo_nota; h[:cons].times do |i| %>
- <th class="cons">
-
- </th>
- <% c = c.try(:consolidado) %>
- <% end %>
- <% end %>
- </tr>
- </thead>
- <% i = 0; n = 0; suma = 0.0 %>
- <% tbody = capture do %>
- <tbody>
- <% estudiantes.each do |e| %>
- <% notas = @hoja[e.id] || [] %>
- <tr>
- <% @hoja[:head].each_with_index do |h, p| %>
- <% notas[p] = { eval: [], cons: [] } if notas[p].nil? %>
- <% h[:eval].times do |i| %>
- <%= calificacion_cell('eval', notas[p][:eval][i], @nota_min) %>
- <% end %>
- <% if h[:acum] > 0 %>
- <%= calificacion_cell('acum' + (h[:eval] + 1 == h[:cols] ? ' last' : ''),
- notas[p][:acum], @nota_min) %>
- <% end %>
- <% if h[:exam] > 0 %>
- <%= calificacion_cell('exam' + (h[:eval] + h[:acum] + 1 == h[:cols] ? ' last' : ''),
- notas[p][:exam], @nota_min) %>
- <% end %>
- <% h[:cons].times do |i| %>
- <%= calificacion_cell('cons' + (h[:eval] + h[:acum] + h[:exam] + i + 1 == h[:cols] ? ' last' : ''),
- notas[p][:cons][i], @nota_min) %>
- <% end %>
- <% %>
- <% end %>
- <td class="tot"><%= calificacion(promedio = e.promedio_materia(@materia.id), @nota_min) %></td>
- <% if e.retirado.nil? && !promedio.nil? %>
- <% suma += promedio; n += 1 %>
- <% end %>
- </tr>
- <% end %>
- </tbody>
- <% end %>
- <tfoot>
- <tr>
- <td></td>
- <td>Promedio total</td>
- <% if numcols > 0 %>
- <td colspan="<%= numcols %>"></td>
- <% end %>
- <td><%= calificacion(n > 0 ? suma / n : nil, @nota_min) %></td>
- </tr>
- </tfoot>
- <%= tbody %>
- </table>
- </div>
- </div>
- <div class="fix_footer">
- <div id="hslider"></div>
- </div>
- <% content_for :botonera do %>
- <%= link_to 'Volver', polymorphic_path([@clase || @seccion, @materia], anchor: 'estudiantes'), class: 'button' %>
- <% end %>
Add Comment
Please, Sign In to add comment