104 lines
2.6 KiB
Java
104 lines
2.6 KiB
Java
package outils;
|
|
|
|
import java.io.BufferedWriter;
|
|
import java.io.IOException;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
import java.nio.file.Paths;
|
|
import java.text.DecimalFormat;
|
|
|
|
import AnalyseCalc.AnalyseClasseur;
|
|
|
|
public class notation {
|
|
|
|
private String note = "0";
|
|
private double totalpoints =0.0;
|
|
private double points =0.0;
|
|
private String proportionString = "0";
|
|
private static String noteCSV = "Nom;Note;Auteur;Nbr auteur;Correspond au sujet;Echange fichier\n\r";
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("###.##");
|
|
|
|
public notation(Boolean fichierCorrespondSujet, Boolean ecritNoteCSV, String nomDossier, AnalyseClasseur AClas ) {
|
|
|
|
for(int i = 0 ; i < AClas.getClasseur().size();i++) {
|
|
points = AClas.getClasseur().get(i).getPoint()*AClas.getClasseur().get(i).getPoids() + points;
|
|
totalpoints = AClas.getClasseur().get(i).getPointtotal()*AClas.getClasseur().get(i).getPoids() + totalpoints;
|
|
}
|
|
|
|
|
|
|
|
if(fichierCorrespondSujet && totalpoints>0 && !AClas.getHisto().isTriche() && !AClas.getHisto().isEmpty() && !AClas.getHisto().isTropCopier() && !AClas.getHisto().isTropModifications()) {
|
|
double proportion = points/totalpoints;
|
|
proportion= Math.pow(proportion, calc.commandes.analyse_progression);
|
|
proportionString = df.format(proportion*100) + "%";
|
|
note = df.format(calc.commandes.analyse_bareme*proportion);
|
|
}else {
|
|
proportionString=df.format(0.00) + "%";
|
|
note =df.format(0.00);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getNote() {
|
|
return note;
|
|
}
|
|
|
|
public void setNote(String note) {
|
|
this.note = note;
|
|
}
|
|
|
|
public double getTotalpoints() {
|
|
return totalpoints;
|
|
}
|
|
|
|
public double getPoints() {
|
|
return points;
|
|
}
|
|
|
|
public void setTotalpoints(double totalpoints) {
|
|
this.totalpoints = totalpoints;
|
|
}
|
|
|
|
public void setPoints(double points) {
|
|
this.points = points;
|
|
}
|
|
|
|
public String getProportionString() {
|
|
return proportionString;
|
|
}
|
|
|
|
|
|
|
|
public String pointbareme(double prop, double bareme) {
|
|
double a = (bareme/totalpoints)*bareme;
|
|
double note = prop*a;
|
|
|
|
return df.format(note) + " / " + df.format(a);
|
|
}
|
|
|
|
public static String getNoteCSV() {
|
|
return noteCSV;
|
|
}
|
|
|
|
public static void publieNotesCSV(String patch) throws IOException {
|
|
System.getProperty("file.encoding","UTF-8");
|
|
Path outputFilePath = Paths.get(patch + "/" +"notes.csv");
|
|
BufferedWriter fichier = Files.newBufferedWriter(outputFilePath, StandardCharsets.UTF_8);
|
|
fichier.write(noteCSV);
|
|
fichier.close();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|