Skip to content

Commit

Permalink
Clarification dashboard admin (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdauphant authored Feb 20, 2020
1 parent 1c3db81 commit b79d8e7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
5 changes: 2 additions & 3 deletions app/controllers/AreaController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ case class AreaController @Inject() (
"CDAD",
"La Poste",
"MSA",
"Pôle emploi",
"Sous-Préf"
"Pôle emploi"
).map(Set(_))
).map(_.flatMap(id => Organisation.byId(Organisation.Id(id))))

Expand Down Expand Up @@ -137,7 +136,7 @@ case class AreaController @Inject() (
}

val data = for {
area <- request.currentUser.areas.flatMap(Area.fromId)
area <- request.currentUser.areas.flatMap(Area.fromId).filterNot(_.name == "Demo")
} yield {
val organisationMap: List[(Set[Organisation], Int)] = for {
organisations <- organisationGrouping
Expand Down
6 changes: 3 additions & 3 deletions app/models/Area.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ object Area {
Area("Cher", "Cher", "18"),
Area("Correze", "Corrèze", "19"),
Area("Corse-du-Sud", "Corse-du-Sud", "2A"),
Area("Cote-d'Or", "Côte-d'Or", "21"),
Area("Cotes-d'Armor", "Côtes-d'Armor", "22"),
Area("Cote-d'Or", "Côte-dOr", "21"),
Area("Cotes-d'Armor", "Côtes-dArmor", "22"),
Area("Creuse", "Creuse", "23"),
Area("Deux-Sevres", "Deux-Sèvres", "79"),
Area("dordogne", "Dordogne", "24"),
Expand Down Expand Up @@ -121,7 +121,7 @@ object Area {
Area("Tarn", "Tarn", "81"),
Area("Tarn-et-Garonne", "Tarn-et-Garonne", "82"),
Area("Territoire de Belfort", "Territoire de Belfort", "90"),
Area("argenteuil", "Val-d'Oise", "95"),
Area("argenteuil", "Val-dOise", "95"),
Area("val-de-marne", "Val-de-Marne", "94"),
Area("var", "Var", "83"),
Area("vaucluse", "Vaucluse", "84"),
Expand Down
53 changes: 33 additions & 20 deletions app/views/deploymentDashboard.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ <h5 class="title--addline">Nombre d'agents instructeurs par organisation</h5>
},
}
{
area: "TOTAUX (de structure)",
area: "Couverture",
@for((organisations, count) <- organisationSetToCountOfCounts) {
@{organisations.map(_.id.toString).mkString} : @count,
@{organisations.map(_.id.toString).mkString} : "@count",
}
total: ""
}
total: "",
},
{
area: "Avancement",
@for((organisations, count) <- organisationSetToCountOfCounts) {
@{organisations.map(_.id.toString).mkString} : "@(math.round(count*1000/data.length).toFloat/10) %",
}
total: "",
},
]

var columns = [
Expand All @@ -53,7 +60,7 @@ <h5 class="title--addline">Nombre d'agents instructeurs par organisation</h5>
headerVertical:true,
formatter: function(cell, formatterParams, onRendered) {
var value = cell.getValue();
if (cell._cell.row.data.area == "TOTAUX (de structure)") {
if (cell._cell.row.data.area == "Couverture") {
if (value < 1) {
cell._cell.element.classList.add("mdl-color--red");
} else if (value <= 4) {
Expand All @@ -63,34 +70,40 @@ <h5 class="title--addline">Nombre d'agents instructeurs par organisation</h5>
} else {
cell._cell.element.classList.add("mdl-color--dark-green");
}
value = value + ' / @data.length';
return value;
}
if (value < 1) {
cell._cell.element.classList.add("mdl-color--red");
} else if (value >= 2) {
cell._cell.element.classList.add("mdl-color--green");
} else {
cell._cell.element.classList.add("mdl-color--yellow");
if (cell._cell.row.data.area !== "Avancement") {
if (value < 1) {
cell._cell.element.classList.add("mdl-color--red");
} else if (value >= 2) {
cell._cell.element.classList.add("mdl-color--green");
} else {
cell._cell.element.classList.add("mdl-color--yellow");
}
}
return value;
}
},
},
{
title: "TOTAUX (de structure)",
title: "Couverture",
field: "total",
sorter: "number",
headerVertical: true,
formatter: function(cell, formatterParams, onRendered) {
var value = cell.getValue();
if (value < 1) {
cell._cell.element.classList.add("mdl-color--red");
} else if (value <= 4) {
cell._cell.element.classList.add("mdl-color--light-green");
} else if (value <= 7){
cell._cell.element.classList.add("mdl-color--medium-green");
} else {
cell._cell.element.classList.add("mdl-color--dark-green");
if (value !== '') {
if (value < 1) {
cell._cell.element.classList.add("mdl-color--red");
} else if (value <= 4) {
cell._cell.element.classList.add("mdl-color--light-green");
} else if (value <= 7){
cell._cell.element.classList.add("mdl-color--medium-green");
} else {
cell._cell.element.classList.add("mdl-color--dark-green");
}
value = value + ' / @data.head._2.length';
}
return value;
}
Expand Down

0 comments on commit b79d8e7

Please sign in to comment.