Import Bugfix + Report add rating + readme + edit tour bugfix + add wait cursor
This commit is contained in:
parent
f2aa9576ba
commit
d92f538129
@ -1,4 +1,6 @@
|
||||
# Tourplaner
|
||||
* JavaDoc: https://dergeorg.at/javadoc
|
||||
* DoxygenDoc: https://dergeorg.at/doxygendoc/html
|
||||
|
||||
# Config
|
||||
* DB informationen müssen in das config.ini.sample unter ```[db]``` eingetragen werden
|
||||
|
@ -50,19 +50,25 @@ public class Exporter {
|
||||
try {
|
||||
ArrayList<Tour> touren = JsonHelper.getTourenFromJson(new FileReader(EinheitenAdder.addJson(this.path)));
|
||||
DbConnect dbConnect = new DbConnect();
|
||||
dbConnect.delAllData();
|
||||
progressBar.addProgress(5);
|
||||
int size = progressBar.getProgressSize(touren.size() * 3, 100);
|
||||
ArrayList<Tour> allTours = dbConnect.getAllTouren();
|
||||
progressBar.addProgress(2);
|
||||
int size = progressBar.getProgressSize(allTours.size(), 25);
|
||||
allTours.forEach(t -> {
|
||||
TourPlaner.delTour(t.getName());
|
||||
progressBar.addProgress(size);
|
||||
});
|
||||
|
||||
int finalSize = progressBar.getProgressSize(touren.size() * 3, 100);
|
||||
for (Tour tour: touren) {
|
||||
new DirectionMap(tour.getStart(), tour.getZiel(), tour.getName());
|
||||
progressBar.addProgress(size);
|
||||
progressBar.addProgress(finalSize);
|
||||
dbConnect.addTour(tour);
|
||||
progressBar.addProgress(size);
|
||||
progressBar.addProgress(finalSize);
|
||||
ArrayList<Log> logs = tour.getLogs();
|
||||
for (Log log:logs) {
|
||||
dbConnect.addLog(tour.getName(), log);
|
||||
}
|
||||
progressBar.addProgress(size);
|
||||
progressBar.addProgress(finalSize);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LogHelper.error(e);
|
||||
|
@ -40,6 +40,7 @@ public class Reporter {
|
||||
Document document = new Document();
|
||||
PdfWriter.getInstance(document, new FileOutputStream(file));
|
||||
document.open();
|
||||
addMetaData(document, new Tour("Summary", "String dauer", "String mapJson", 1, "String start", "String ziel"));
|
||||
addSumRepo(document, tours);
|
||||
|
||||
document.close();
|
||||
@ -173,6 +174,7 @@ public class Reporter {
|
||||
subCatPart.add(new Paragraph(EinheitenAdder.addKm(ConfigHelper.getLangIniString("logstrecke") + " " + log.getStrecke())));
|
||||
subCatPart.add(new Paragraph(EinheitenAdder.addMeter(ConfigHelper.getLangIniString("loghight") + " " + log.getHightmeter())));
|
||||
subCatPart.add(new Paragraph(ConfigHelper.getLangIniString("logbemerkung") + " " + log.getBemerkung()));
|
||||
subCatPart.add(new Paragraph( "Rating " + log.getRating()));
|
||||
}
|
||||
// now add all this to the document
|
||||
document.add(catPart);
|
||||
|
@ -59,14 +59,9 @@ public class TourPlaner{
|
||||
* @return false bei error
|
||||
*/
|
||||
public static boolean delTour(String tourname){
|
||||
ProgressBar progressBar = new ProgressBar("Del...");
|
||||
int step = progressBar.getProgressSize(3, 100);
|
||||
FileHelper.delFile(new File(getImagePath(tourname)));
|
||||
progressBar.addProgress(step);
|
||||
FileHelper.delFile(new File(getImagePdfPath(tourname)));
|
||||
progressBar.addProgress(step);
|
||||
boolean ret = new DbConnect().delTour(tourname);
|
||||
progressBar.setProgress(100);
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ public class DbConnect {
|
||||
|
||||
public boolean editLog(String tourname, Log log){
|
||||
return PostgresHelper.executeUpdate("UPDATE public.log SET bemerkung = '"+log.getBemerkung()+"', datum = '"+log.getDatum()+"', strecke = "+log.getStrecke()+", avg = "+log.getAvgspeed()+", hightmeter = "+
|
||||
log.getHightmeter()+", pause = "+log.getPause()+", gegangen = "+log.getGegangen()+", dauer = "+log.getDauer()+" WHERE tourname = '"+tourname+"' and id = '"+log.getId()+"', rating = '"+log.getRating()+"'");
|
||||
log.getHightmeter()+", pause = "+log.getPause()+", gegangen = "+log.getGegangen()+", dauer = "+log.getDauer()+", rating = '"+log.getRating()+"' WHERE tourname = '"+tourname+"' and id = '"+log.getId()+"'");
|
||||
}
|
||||
|
||||
public boolean delLog(String tourname, String id){
|
||||
|
@ -28,6 +28,7 @@ public class ProgressBar {
|
||||
Container content = this.frame.getContentPane();
|
||||
this.progressBar = new JProgressBar();
|
||||
this.progressBar.setValue(0);
|
||||
this.progressBar.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
this.progressBar.setStringPainted(true);
|
||||
TitledBorder border = BorderFactory.createTitledBorder("Laden....");
|
||||
this.progressBar.setBorder(border);
|
||||
|
@ -506,8 +506,10 @@ public class ViewModel {
|
||||
tourData.removeIf(s -> s.getName().equals(tourname));
|
||||
tourNamen.removeIf(s -> s.equals(tourname));
|
||||
logData.removeIf(s -> true);
|
||||
ProgressBar progressBar = new ProgressBar("");
|
||||
TourPlaner.delTour(tourname);
|
||||
setSelectedTour(null);
|
||||
progressBar.setProgress(100);
|
||||
} catch (NullPointerException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user