Fixed long questions and answers #29

Merged
H4CK3R-01 merged 1 commits from design_fix into main 2021-06-15 06:46:56 +00:00
5 changed files with 46 additions and 2432 deletions

View File

@ -42,7 +42,7 @@
{ {
"id": "5", "id": "5",
"difficulty": "1", "difficulty": "1",
"question": "Was gehört nicht direkt zum Finanzmanagement? ", "question": "Was gehört nicht direkt zum Finanzmanagement?",
"key": "D", "key": "D",
"A": "Budgeteinteilung", "A": "Budgeteinteilung",
"B": "Erstellen eines Finanzplans", "B": "Erstellen eines Finanzplans",
@ -844,8 +844,8 @@
"difficulty": "1", "difficulty": "1",
"question": "Was ist keine Eigenschaft eines Projekts?", "question": "Was ist keine Eigenschaft eines Projekts?",
"key": "C", "key": "C",
"A": "Ein terminlicher Rahmen  ", "A": "Ein terminlicher Rahmen",
"B": "Planung ", "B": "Planung",
"C": "Regelmäßige Durchführung", "C": "Regelmäßige Durchführung",
"D": "Teamarbeit" "D": "Teamarbeit"
}, },

File diff suppressed because one or more lines are too long

View File

@ -4,8 +4,11 @@ if __name__ == '__main__':
array = [] array = []
with open('fragen_10_06_21_final.json') as file: with open('fragen_10_06_21_final.json') as file:
data = json.load(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)): for i in range(0, len(data)):
new = {'id': int(data[i]['id']), 'difficulty': int(data[i]['difficulty']), 'question': data[i]['question'], new = {'id': int(data[i]['id']), 'difficulty': int(data[i]['difficulty']), 'question': data[i]['question'],
'answers': []} 'answers': []}
@ -23,8 +26,34 @@ if __name__ == '__main__':
"status": 'D' == data[i]['key'] "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) 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: with open('fragen_10_06_21_final_new_format.json', 'w', encoding='utf8') as file:
json.dump(array, file, ensure_ascii=False) json.dump(array, file, ensure_ascii=False)
print(len(data))

View File

@ -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.graphics = new PIXI.Graphics();
this.default_color = default_color; this.default_color = default_color;
this.hover_color = hover_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.y = y;
this.text = text; this.text = text;
this.status = status; this.status = status;
this.button_is_answer = button_is_answer;
this.pointerdown = click; this.pointerdown = click;
this.selected = false; this.selected = false;
let _this = this; let _this = this;
@ -35,9 +34,11 @@ function Button(default_color, hover_color, select_color, width, height, x, y, t
this.getButton = function () { this.getButton = function () {
const style = new PIXI.TextStyle({ const style = new PIXI.TextStyle({
fontFamily: 'Arial', fontFamily: 'Arial',
fontSize: 60, fontSize: 40,
wordWrap: true, wordWrap: true,
wordWrapWidth: game_board_size * 0.5 - 20, wordWrapWidth: this.width,
breakWords: true,
lineJoin: 'miter'
}); });
this.graphics.clear(); this.graphics.clear();

View File

@ -21,7 +21,7 @@ function Card(game_board_size, s, a1, a2, a3, a4, d, your_turn) {
this.showCard = function () { this.showCard = function () {
const style = new PIXI.TextStyle({ const style = new PIXI.TextStyle({
fontFamily: 'Arial', fontFamily: 'Arial',
fontSize: 60, fontSize: 50,
wordWrap: true, wordWrap: true,
wordWrapWidth: game_board_size * 0.5 - 20, 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); this.card.addChild(basicText);
// Answers // 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) { if (_this.your_turn) {
select_answer(0, _this.a1.text); 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) { if (_this.your_turn) {
select_answer(1, _this.a2.text); 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) { if (_this.your_turn) {
select_answer(2, _this.a3.text); 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) { if (_this.your_turn) {
select_answer(3, _this.a4.text); 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 // 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 (answer !== null) {
if (_this.right_answer === answer) { if (_this.right_answer === answer) {
console.log("Richtig"); console.log("Richtig");