Skip to content

Commit

Permalink
[fix] no question for codecharts (#46)
Browse files Browse the repository at this point in the history
* [fix] no question for codecharts

* [fix] Anpassungen getroffen
  • Loading branch information
joshuajeschek authored Feb 7, 2022
1 parent e5c252a commit 8b06b4d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,23 @@ protected Configuration() {
* Konstruktor für Configuration vom Typ CodeChartsConfiguration.
*
* @param configId - configId der übergebenen Konfiguration
* @param question - Fragestellung zum Versuch
* @param imageUrl - die URL des Bildes
* @param intro - das Intro
* @param outro - das Outro
* @param tutorial - ob das Tutorial angezeigt werden soll
* @param codeChartsConfiguration - Konfiguration von CodeCharts
*/
public Configuration(String configId, String question, String imageUrl,
public Configuration(String configId, String imageUrl,
String intro, String outro, boolean tutorial,
CodeChartsConfiguration codeChartsConfiguration) {
this.toolType = ToolType.CODECHARTS;
this.question = question;
this.configId = configId;
this.imageUrl = imageUrl;
this.intro = intro;
this.outro = outro;
this.tutorial = tutorial;
this.codeChartsConfiguration = codeChartsConfiguration;
this.question = null;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/github/weichware10/util/db/Configurations.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public Configuration get(String configId) {
// bei jedem Typ existent
ToolType toolType = ToolType.valueOf(rs.getString("tooltype"));
String imageUrl = rs.getString("imageurl");
String question = rs.getString("question");
String intro = rs.getString("intro");
String outro = rs.getString("outro");
boolean tutorial = rs.getBoolean("tutorial");
Expand Down Expand Up @@ -85,13 +84,14 @@ public Configuration get(String configId) {
randomized, maxDepth, iterations, defaultHorizontal, defaultVertical);

// komplette Konfiguration zurückgeben
configuration = new Configuration(configId, question, imageUrl, intro, outro,
configuration = new Configuration(configId, imageUrl, intro, outro,
tutorial, codeChartsConfiguration);
} else {
// ZOOMMAPS spezifische Werte
double speed = rs.getDouble("speed");
double imageViewWidth = rs.getDouble("imageview_width");
double imageViewHeight = rs.getDouble("imageview_height");
String question = rs.getString("question");

// ZoomMapsConfiguration erstellen
ZoomMapsConfiguration zoomMapsConfiguration = new ZoomMapsConfiguration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void loadingShouldReturnCorrectBooleanDataBase() {
// set config to test with
final String configId = dbClient.configurations.set(new Configuration(
"null",
"question?",
"url",
"intro",
"outro",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void shouldOnlyLoadFromValidTrialId() {
// set config to test with
final String configId = dbClient.configurations.set(new Configuration(
"null",
"question?",
"url",
"intro",
"outro",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ public void onlyWriteToDataBase() {
dotenv.get("DB_PASSWORD"),
dotenv.get("DB_SCHEMA"));

String configId = ConfigWriter.toDataBase(new Configuration("null", "question?", "url",
"intro", "outro", true,
new CodeChartsConfiguration()), dbClient);
String configId = ConfigWriter.toDataBase(new Configuration("null", "url",
"intro", "outro", true, new CodeChartsConfiguration()), dbClient);
assertTrue("ConfigWriter should write to valid database", configId != null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ConfigurationTest {

@Test
public void toStringWorks() {
Configuration ccc = new Configuration("con_id", "question?", "url", "intro", "outro", true,
Configuration ccc = new Configuration("con_id", "url", "intro", "outro", true,
new CodeChartsConfiguration());
Configuration zmc = new Configuration("con_id", "question?", "url", "intro", "outro", true,
new ZoomMapsConfiguration());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public static void configurationsTestSetup() {
new int[]{ 3, 5 }, new long[]{ 300, 500 },
false, true, true, 5, 15, -1, -1);

ccConfig = new Configuration("dunno yet", null, "url", "intro", "outro", true,
ccConfig = new Configuration("dunno yet", "url", "intro", "outro", true,
codeChartsConfiguration);
String ccConfigId = dbClient.configurations.set(ccConfig);
ccConfig = new Configuration(ccConfigId, null, "url", "intro", "outro", true,
ccConfig = new Configuration(ccConfigId, "url", "intro", "outro", true,
codeChartsConfiguration);

ZoomMapsConfiguration zoomMapsConfiguration1 = new ZoomMapsConfiguration(4, 30, 30);
Expand Down Expand Up @@ -71,7 +71,7 @@ public void setConfigurationsShouldWork() {
Configuration config;
String configId;

config = new Configuration("", "Question?", "url", "intro", "outro", true,
config = new Configuration("", "url", "intro", "outro", true,
codeChartsConfiguration);
configId = dbClient.configurations.set(config);
assertTrue("configId sollte mit con_ anfangen.", configId.startsWith("con_"));
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/github/weichware10/util/db/TrialsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public static void trialsTestSetup() {
"OBST", Arrays.asList("banane", "orange"),
new int[] { 3, 5 }, new long[] { 300, 500 },
false, true, true, 5, 15, -1, -1);
codeConfig = new Configuration("temp", "Warum ist die Banane krumm?", "url",
"intro", "outro", true, ccConf);
codeConfig = new Configuration("temp", "url", "intro", "outro", true, ccConf);
configIdCc = dbClient.configurations.set(codeConfig);

ZoomMapsConfiguration zmConf = new ZoomMapsConfiguration(4.3, 300, 300);
Expand Down

0 comments on commit 8b06b4d

Please sign in to comment.