Merge branch 'Feature/explanation' into 'master'

Explanation in first calculator screen

See merge request cse1105/2018-2019/oopp-group-43/template!84
This commit is contained in:
Merel Steenbergen
2019-04-10 20:43:41 +00:00
4 changed files with 29 additions and 10 deletions

View File

@@ -235,7 +235,7 @@ public class RegisterWindowController {
//close the register window after the user has entered all the credentials
Stage current = (Stage) owner;
current.close();
Parent calc = Application.load(this.getClass().getClassLoader()
.getResource("fxml/FirstCalculator.fxml"));
Scene scene = new Scene(calc);

View File

@@ -1,13 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.shape.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Slider?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane prefHeight="703.0" prefWidth="820.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.RegisterWindowController">
<AnchorPane prefHeight="703.0" prefWidth="820.0" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.RegisterWindowController">
<children>
<AnchorPane fx:id="calculatorTabs" prefHeight="92.0" prefWidth="820.0" style="-fx-background-color: #677069;">
<children>
@@ -146,6 +154,12 @@
</Label>
<Button fx:id="getStartedNextButton" layoutX="383.0" layoutY="406.0" mnemonicParsing="false" onAction="#displayTravel" styleClass="nextButton" text="Next" />
<Line endX="79.0" layoutX="147.0" layoutY="14.0" stroke="#545b54" />
<Text layoutX="296.0" layoutY="51.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Welcome to Greenify!">
<font>
<Font name="System Bold" size="22.0" />
</font>
</Text>
<Text layoutX="15.0" layoutY="459.0" strokeType="OUTSIDE" strokeWidth="0.0" text="This application will help you decrease your CO2-footprint. In the next screen, you will be asked to fill in certain things, like your yearly energy costs. These values will help us calculate your CO2-footprint. Warning: If you don't fill anything in, the calculator will use a default value based on averages, so if you want a value to be zero, please fill in zero. After that, you'll be able to see your score and compare your footprint to those of your friends. Let's go green and save the planet!" textAlignment="CENTER" wrappingWidth="714.0" />
</children></AnchorPane>
<AnchorPane fx:id="travelPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false">
<children>

View File

@@ -78,8 +78,8 @@ public class AchievementService {
* @param user user for whom achiev6 changes
*/
public void achieveLetItShine(User user) {
int solar_panels = Integer.parseInt(user.getExtraInputs().get("solar_panels"));
if (solar_panels >= 2) {
int solarPanels = Integer.parseInt(user.getExtraInputs().get("solar_panels"));
if (solarPanels >= 2) {
userService.setAchievement(user.getName(), "Let it shine", true);
}
}

View File

@@ -110,6 +110,11 @@ public class CalculatorService {
user.setFootPrintInputs(inputs);
}
/**
* Gets the result of the CO2-calculation from the CoolClimate website
* @param map results that the user filled in
* @return the results from the website.
*/
public Map<String, String> getResults(Map<String, String> map) {
HttpHeaders headers = new HttpHeaders();
headers.set("accept", MediaType.APPLICATION_JSON_VALUE);