Fixed long questions and answers #29
@ -42,7 +42,7 @@
|
||||
{
|
||||
"id": "5",
|
||||
"difficulty": "1",
|
||||
"question": "Was gehört nicht direkt zum Finanzmanagement? ",
|
||||
"question": "Was gehört nicht direkt zum Finanzmanagement?",
|
||||
"key": "D",
|
||||
"A": "Budgeteinteilung",
|
||||
"B": "Erstellen eines Finanzplans",
|
||||
@ -844,8 +844,8 @@
|
||||
"difficulty": "1",
|
||||
"question": "Was ist keine Eigenschaft eines Projekts?",
|
||||
"key": "C",
|
||||
"A": "Ein terminlicher Rahmen ",
|
||||
"B": "Planung ",
|
||||
"A": "Ein terminlicher Rahmen",
|
||||
"B": "Planung",
|
||||
"C": "Regelmäßige Durchführung",
|
||||
"D": "Teamarbeit"
|
||||
},
|
||||
|
File diff suppressed because one or more lines are too long
33
data/main.py
33
data/main.py
@ -4,8 +4,11 @@ if __name__ == '__main__':
|
||||
array = []
|
||||
with open('fragen_10_06_21_final.json') as file:
|
||||
data = json.load(file)
|
||||
print(len(data))
|
||||
|
||||
length_q = 0
|
||||
id_q = 0
|
||||
length = 0
|
||||
id = 0
|
||||
for i in range(0, len(data)):
|
||||
new = {'id': int(data[i]['id']), 'difficulty': int(data[i]['difficulty']), 'question': data[i]['question'],
|
||||
'answers': []}
|
||||
@ -23,8 +26,34 @@ if __name__ == '__main__':
|
||||
"status": 'D' == data[i]['key']
|
||||
})
|
||||
|
||||
|
||||
if(length_q < len(data[i]['question'])):
|
||||
length_q = len(data[i]['question'])
|
||||
|
||||
|
||||
if(length < len(data[i]['A'])):
|
||||
length = len(data[i]['A'])
|
||||
if(length < len(data[i]['B'])):
|
||||
length = len(data[i]['B'])
|
||||
if(length < len(data[i]['C'])):
|
||||
length = len(data[i]['C'])
|
||||
if(length < len(data[i]['D'])):
|
||||
length = len(data[i]['D'])
|
||||
|
||||
array.append(new)
|
||||
|
||||
print("Längste Frage: " + str(length))
|
||||
print("Längste Antwort: " + str(length_q))
|
||||
|
||||
with open('fragen_10_06_21_final.json') as file:
|
||||
data = json.load(file)
|
||||
|
||||
for i in range(0, len(data)):
|
||||
if(length_q == len(data[i]['question'])):
|
||||
print("Längste Frage ID: " + str(data[i]['id']))
|
||||
|
||||
if(length == len(data[i]['A']) or length == len(data[i]['B']) or length == len(data[i]['C']) or length == len(data[i]['D'])):
|
||||
print("Längste Antwort ID: " + str(data[i]['id']))
|
||||
|
||||
with open('fragen_10_06_21_final_new_format.json', 'w', encoding='utf8') as file:
|
||||
json.dump(array, file, ensure_ascii=False)
|
||||
print(len(data))
|
||||
|
@ -1,4 +1,4 @@
|
||||
function Button(default_color, hover_color, select_color, width, height, x, y, text, status, button_is_answer, click) {
|
||||
function Button(default_color, hover_color, select_color, width, height, x, y, text, status, click) {
|
||||
this.graphics = new PIXI.Graphics();
|
||||
this.default_color = default_color;
|
||||
this.hover_color = hover_color;
|
||||
@ -8,7 +8,6 @@ function Button(default_color, hover_color, select_color, width, height, x, y, t
|
||||
this.y = y;
|
||||
this.text = text;
|
||||
this.status = status;
|
||||
this.button_is_answer = button_is_answer;
|
||||
this.pointerdown = click;
|
||||
this.selected = false;
|
||||
let _this = this;
|
||||
@ -35,9 +34,11 @@ function Button(default_color, hover_color, select_color, width, height, x, y, t
|
||||
this.getButton = function () {
|
||||
const style = new PIXI.TextStyle({
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 60,
|
||||
fontSize: 40,
|
||||
wordWrap: true,
|
||||
wordWrapWidth: game_board_size * 0.5 - 20,
|
||||
wordWrapWidth: this.width,
|
||||
breakWords: true,
|
||||
lineJoin: 'miter'
|
||||
});
|
||||
|
||||
this.graphics.clear();
|
||||
|
@ -21,7 +21,7 @@ function Card(game_board_size, s, a1, a2, a3, a4, d, your_turn) {
|
||||
this.showCard = function () {
|
||||
const style = new PIXI.TextStyle({
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 60,
|
||||
fontSize: 50,
|
||||
wordWrap: true,
|
||||
wordWrapWidth: game_board_size * 0.5 - 20,
|
||||
});
|
||||
@ -49,25 +49,25 @@ function Card(game_board_size, s, a1, a2, a3, a4, d, your_turn) {
|
||||
this.card.addChild(basicText);
|
||||
|
||||
// Answers
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 150, this.card_x + 20, this.card_y + this.card_height - 120 - 170 * 4, this.a1.text, this.a1.status, true, function () {
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 200, this.card_x + 20, this.card_y + this.card_height - 120 - 220 * 4, this.a1.text, this.a1.status, function () {
|
||||
if (_this.your_turn) {
|
||||
select_answer(0, _this.a1.text);
|
||||
}
|
||||
}));
|
||||
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 150, this.card_x + 20, this.card_y + this.card_height - 120 - 170 * 3, this.a2.text, this.a2.status, true, function () {
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 200, this.card_x + 20, this.card_y + this.card_height - 120 - 220 * 3, this.a2.text, this.a2.status, function () {
|
||||
if (_this.your_turn) {
|
||||
select_answer(1, _this.a2.text);
|
||||
}
|
||||
}));
|
||||
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 150, this.card_x + 20, this.card_y + this.card_height - 120 - 170 * 2, this.a3.text, this.a3.status, true, function () {
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 200, this.card_x + 20, this.card_y + this.card_height - 120 - 220 * 2, this.a3.text, this.a3.status, function () {
|
||||
if (_this.your_turn) {
|
||||
select_answer(2, _this.a3.text);
|
||||
}
|
||||
}));
|
||||
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 150, this.card_x + 20, this.card_y + this.card_height - 120 - 170 * 1, this.a4.text, this.a4.status, true, function () {
|
||||
this.buttons.push(new Button(0xffffff, 0xcccccc, 0x4169E1, this.card_width - 40, 200, this.card_x + 20, this.card_y + this.card_height - 120 - 220 * 1, this.a4.text, this.a4.status, function () {
|
||||
if (_this.your_turn) {
|
||||
select_answer(3, _this.a4.text);
|
||||
}
|
||||
@ -77,7 +77,7 @@ function Card(game_board_size, s, a1, a2, a3, a4, d, your_turn) {
|
||||
|
||||
|
||||
// OK-Button
|
||||
this.card.addChild(new Button(0xffffff, 0xcccccc, 0xffffff, this.card_width - 40, 100, this.card_x + 20, this.card_y + this.card_height - 120, "OK", null, false, function () {
|
||||
this.card.addChild(new Button(0xffffff, 0xcccccc, 0xffffff, this.card_width - 40, 100, this.card_x + 20, this.card_y + this.card_height - 120, "OK", null, function () {
|
||||
if (answer !== null) {
|
||||
if (_this.right_answer === answer) {
|
||||
console.log("Richtig");
|
||||
|
Loading…
Reference in New Issue
Block a user