From 0e439cd0bea51efb9362c75011d9efed548ad617 Mon Sep 17 00:00:00 2001
From: Walmes Zeviani <walmes@ufpr.br>
Date: Mon, 18 Dec 2017 19:51:54 -0200
Subject: [PATCH] =?UTF-8?q?Lan=C3=A7a=20as=20faltas=20e=20condi=C3=A7?=
 =?UTF-8?q?=C3=A3o=20de=20aprovado.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 notas.Rmd | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/notas.Rmd b/notas.Rmd
index 7cf4955..4bdd889 100644
--- a/notas.Rmd
+++ b/notas.Rmd
@@ -182,9 +182,15 @@ if (!is.null(nt$MF2)) {
     nt$"M. final" <- nt$MF2
 }
 
+# Verifica se o aluno está aprovado.
+if (!is.null(nt$"M. final") & !is.null(nt$E) & !is.null(nt$F)) {
+    nt$A <- ifelse(nt$"M. final" >= 50 &
+                   nt$F <= 15, "A", "R")
+}
+
 #-----------------------------------------------------------------------
 
-v <- c("GRR", u, c("M. parcial", "E", "M. final"))
+v <- c("GRR", u, c("M. parcial", "E", "M. final", "F", "A"))
 v <- v[v %in% names(nt)]
 
 # nt <- plyr::arrange(nt, -mp)
@@ -242,8 +248,13 @@ dt <- datatable(data = subset(nt, select = v),
               lengthMenu = NULL))
 
 dt <- formatStyle(table = dt,
-                  columns = !(v %in% c("Nome", "GRR", "F", "M. final")),
-                  color = styleInterval(cuts = c(39.999999, 69.999999),
+                  columns = !(v %in% c("Nome",
+                                       "GRR",
+                                       "F",
+                                       "M. final",
+                                       "A")),
+                  color = styleInterval(cuts = c(39.999999,
+                                                 69.999999),
                                         values = c("#ff3300",
                                                    "gray",
                                                    "#3333ff")))
@@ -256,6 +267,22 @@ if ("E" %in% v) {
                                                        "#3333ff")))
 }
 
+if ("F" %in% v) {
+    dt <- formatStyle(table = dt,
+                      columns = (v %in% c("F")),
+                      color = styleInterval(cuts = c(16),
+                                            values = c("#ff3300",
+                                                       "#3333ff")[2:1]))
+}
+
+if ("A" %in% v) {
+    dt <- formatStyle(table = dt,
+                      columns = (v %in% c("A")),
+                      color = styleEqual(levels = c("R", "A"),
+                                         values = c("#ff3300",
+                                                    "#3333ff")))
+}
+
 is.decimal <- function(x) is.numeric(x) && !is.integer(x)
 
 formatRound(table = dt,
-- 
GitLab