eaglelandsonce commited on
Commit
9e21b1d
·
verified ·
1 Parent(s): 24267a6

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +59 -115
index.html CHANGED
@@ -11,6 +11,7 @@
11
  flex-direction: column;
12
  align-items: center;
13
  background-color: #f0f0f0;
 
14
  }
15
  h1 {
16
  color: #0078D4;
@@ -18,22 +19,35 @@
18
  #game-board {
19
  display: grid;
20
  grid-template-columns: repeat(5, 1fr);
21
- gap: 10px;
22
- margin-bottom: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
  .card {
25
- width: 150px;
26
- height: 100px;
27
  background-color: #0078D4;
28
- color: #ffffff;
29
  display: flex;
30
  justify-content: center;
31
  align-items: center;
32
  font-size: 16px;
33
  font-weight: bold;
34
  cursor: pointer;
35
- transition: background-color 0.3s;
36
  text-align: center;
 
37
  }
38
  .card:hover {
39
  background-color: #005a9e;
@@ -63,7 +77,15 @@
63
  <body>
64
  <h1>DAX Jeopardy</h1>
65
  <p><strong>Learn More:</strong> <a href="https://learn.microsoft.com/en-us/dax/" target="_blank">DAX Documentation</a></p>
66
- <div id="game-board"></div>
 
 
 
 
 
 
 
 
67
  <div id="question-display"></div>
68
  <div id="score">Score: 0</div>
69
 
@@ -71,117 +93,57 @@
71
  const categories = ['Basics', 'Functions', 'Context', 'Formulas', 'Troubleshooting'];
72
  const questions = [
73
  [
74
- {
75
- q: "What does DAX stand for?",
76
- a: ["Data Analysis Expressions", "Dynamic Analysis Extensions", "Data Analytics Extra"],
77
- correct: 0
78
- },
79
- {
80
- q: "Which tool does NOT use DAX?",
81
- a: ["Power BI", "Excel", "Notepad++"],
82
- correct: 2
83
- },
84
- {
85
- q: "What is the primary use of DAX?",
86
- a: ["Creating relationships", "Performing advanced calculations", "Designing UIs"],
87
- correct: 1
88
- }
89
  ],
90
  [
91
- {
92
- q: "Which function calculates the sum of a column?",
93
- a: ["COUNT", "SUM", "AVERAGE"],
94
- correct: 1
95
- },
96
- {
97
- q: "What does the RELATED function do?",
98
- a: ["Creates relationships", "Fetches related table values", "Deletes relationships"],
99
- correct: 1
100
- },
101
- {
102
- q: "Which function calculates dynamic totals over a filtered table?",
103
- a: ["SUMX", "COUNT", "MIN"],
104
- correct: 0
105
- }
106
  ],
107
  [
108
- {
109
- q: "What are the types of context in DAX?",
110
- a: ["Row, Filter, Query", "Row, Column, Cell", "Table, Query, Function"],
111
- correct: 0
112
- },
113
- {
114
- q: "What is row context?",
115
- a: ["The entire table", "The current row being evaluated", "All rows in the column"],
116
- correct: 1
117
- },
118
- {
119
- q: "Which function allows access to an earlier row context?",
120
- a: ["EARLIER", "ROWCONTEXT", "PREVIOUS"],
121
- correct: 0
122
- }
123
  ],
124
  [
125
- {
126
- q: "What symbol starts every DAX formula?",
127
- a: ["=", "+", "*"],
128
- correct: 0
129
- },
130
- {
131
- q: "What does a calculated column do?",
132
- a: ["Applies filters", "Adds computed values to rows", "Creates relationships"],
133
- correct: 1
134
- },
135
- {
136
- q: "Which function creates a calculated table?",
137
- a: ["SUMMARIZECOLUMNS", "ADDCOLUMNS", "CALCULATETABLE"],
138
- correct: 2
139
- }
140
  ],
141
  [
142
- {
143
- q: "What error type occurs when a column is missing?",
144
- a: ["Syntax error", "Semantic error", "Calculation error"],
145
- correct: 1
146
- },
147
- {
148
- q: "What might cause unexpected results in a formula?",
149
- a: ["Data type mismatches", "Correct column names", "Updated data models"],
150
- correct: 0
151
- },
152
- {
153
- q: "What does AutoComplete help with in DAX?",
154
- a: ["Syntax validation", "Data refresh", "Efficient querying"],
155
- correct: 0
156
- }
157
  ]
158
  ];
159
  let score = 0;
160
- let timeoutId;
161
  const gameBoard = document.getElementById('game-board');
162
  const questionDisplay = document.getElementById('question-display');
163
  const scoreDisplay = document.getElementById('score');
 
164
  function createBoard() {
165
- for (let i = 0; i < 5; i++) {
166
- for (let j = 0; j < 3; j++) {
167
  const card = document.createElement('div');
168
  card.className = 'card';
169
- card.textContent = `${categories[i]} $${(j + 1) * 100}`;
170
- card.onclick = () => showQuestion(i, j, card);
171
  gameBoard.appendChild(card);
172
  }
173
  }
174
  }
 
175
  function showQuestion(category, difficulty, cardElement) {
176
  if (cardElement.classList.contains('disabled')) return;
177
- if (timeoutId) {
178
- clearTimeout(timeoutId);
179
- timeoutId = null;
180
- }
181
  const question = questions[category][difficulty];
182
- let answerHtml = question.a.map((answer, index) =>
183
  `<button class="answer-btn" onclick="checkAnswer(${category}, ${difficulty}, ${index})">${answer}</button>`
184
  ).join('');
 
185
  questionDisplay.innerHTML = `
186
  <h2>${categories[category]} for $${(difficulty + 1) * 100}</h2>
187
  <p>${question.q}</p>
@@ -189,36 +151,18 @@
189
  `;
190
  cardElement.classList.add('disabled');
191
  cardElement.style.backgroundColor = '#cccccc';
192
- cardElement.style.cursor = 'default';
193
  }
 
194
  function checkAnswer(category, difficulty, selectedAnswer) {
195
- const buttons = document.querySelectorAll('.answer-btn');
196
- buttons.forEach(btn => btn.disabled = true);
197
  const question = questions[category][difficulty];
198
  const isCorrect = selectedAnswer === question.correct;
199
  const value = (difficulty + 1) * 100;
200
- if (isCorrect) {
201
- score += value;
202
- questionDisplay.innerHTML += `<p style="color: green;">Correct! You earned $${value}.</p>`;
203
- } else {
204
- score -= value;
205
- questionDisplay.innerHTML += `<p style="color: red;">Sorry, that's incorrect. You lost $${value}. The correct answer was: ${question.a[question.correct]}</p>`;
206
- }
207
  scoreDisplay.textContent = `Score: ${score}`;
208
- timeoutId = setTimeout(() => {
209
- clearQuestion();
210
- checkGameCompletion();
211
- }, 2000);
212
- }
213
- function clearQuestion() {
214
- questionDisplay.innerHTML = '';
215
- }
216
- function checkGameCompletion() {
217
- const remainingCards = document.querySelectorAll('.card:not(.disabled)');
218
- if (remainingCards.length === 0) {
219
- questionDisplay.innerHTML = `<h2>Game Over!</h2><p>Your final score is $${score}.</p>`;
220
- }
221
  }
 
222
  createBoard();
223
  </script>
224
  </body>
 
11
  flex-direction: column;
12
  align-items: center;
13
  background-color: #f0f0f0;
14
+ margin: 0;
15
  }
16
  h1 {
17
  color: #0078D4;
 
19
  #game-board {
20
  display: grid;
21
  grid-template-columns: repeat(5, 1fr);
22
+ grid-auto-rows: 100px;
23
+ gap: 2px;
24
+ margin: 20px 0;
25
+ background-color: #000;
26
+ border: 4px solid #000;
27
+ }
28
+ .category {
29
+ background-color: #005a9e;
30
+ color: #fff;
31
+ font-weight: bold;
32
+ display: flex;
33
+ justify-content: center;
34
+ align-items: center;
35
+ text-align: center;
36
+ font-size: 18px;
37
+ border: 1px solid #000;
38
  }
39
  .card {
 
 
40
  background-color: #0078D4;
41
+ color: #fff;
42
  display: flex;
43
  justify-content: center;
44
  align-items: center;
45
  font-size: 16px;
46
  font-weight: bold;
47
  cursor: pointer;
48
+ border: 1px solid #000;
49
  text-align: center;
50
+ transition: background-color 0.3s;
51
  }
52
  .card:hover {
53
  background-color: #005a9e;
 
77
  <body>
78
  <h1>DAX Jeopardy</h1>
79
  <p><strong>Learn More:</strong> <a href="https://learn.microsoft.com/en-us/dax/" target="_blank">DAX Documentation</a></p>
80
+ <div id="game-board">
81
+ <!-- Categories -->
82
+ <div class="category">Basics</div>
83
+ <div class="category">Functions</div>
84
+ <div class="category">Context</div>
85
+ <div class="category">Formulas</div>
86
+ <div class="category">Troubleshooting</div>
87
+ <!-- Cards will be dynamically added here -->
88
+ </div>
89
  <div id="question-display"></div>
90
  <div id="score">Score: 0</div>
91
 
 
93
  const categories = ['Basics', 'Functions', 'Context', 'Formulas', 'Troubleshooting'];
94
  const questions = [
95
  [
96
+ { q: "What does DAX stand for?", a: ["Data Analysis Expressions", "Dynamic Analysis Extensions", "Data Analytics Extra"], correct: 0 },
97
+ { q: "Which tool does NOT use DAX?", a: ["Power BI", "Excel", "Notepad++"], correct: 2 },
98
+ { q: "What is the primary use of DAX?", a: ["Creating relationships", "Performing advanced calculations", "Designing UIs"], correct: 1 }
 
 
 
 
 
 
 
 
 
 
 
 
99
  ],
100
  [
101
+ { q: "Which function calculates the sum of a column?", a: ["COUNT", "SUM", "AVERAGE"], correct: 1 },
102
+ { q: "What does the RELATED function do?", a: ["Creates relationships", "Fetches related table values", "Deletes relationships"], correct: 1 },
103
+ { q: "Which function calculates dynamic totals over a filtered table?", a: ["SUMX", "COUNT", "MIN"], correct: 0 }
 
 
 
 
 
 
 
 
 
 
 
 
104
  ],
105
  [
106
+ { q: "What are the types of context in DAX?", a: ["Row, Filter, Query", "Row, Column, Cell", "Table, Query, Function"], correct: 0 },
107
+ { q: "What is row context?", a: ["The entire table", "The current row being evaluated", "All rows in the column"], correct: 1 },
108
+ { q: "Which function allows access to an earlier row context?", a: ["EARLIER", "ROWCONTEXT", "PREVIOUS"], correct: 0 }
 
 
 
 
 
 
 
 
 
 
 
 
109
  ],
110
  [
111
+ { q: "What symbol starts every DAX formula?", a: ["=", "+", "*"], correct: 0 },
112
+ { q: "What does a calculated column do?", a: ["Applies filters", "Adds computed values to rows", "Creates relationships"], correct: 1 },
113
+ { q: "Which function creates a calculated table?", a: ["SUMMARIZECOLUMNS", "ADDCOLUMNS", "CALCULATETABLE"], correct: 2 }
 
 
 
 
 
 
 
 
 
 
 
 
114
  ],
115
  [
116
+ { q: "What error type occurs when a column is missing?", a: ["Syntax error", "Semantic error", "Calculation error"], correct: 1 },
117
+ { q: "What might cause unexpected results in a formula?", a: ["Data type mismatches", "Correct column names", "Updated data models"], correct: 0 },
118
+ { q: "What does AutoComplete help with in DAX?", a: ["Syntax validation", "Data refresh", "Efficient querying"], correct: 0 }
 
 
 
 
 
 
 
 
 
 
 
 
119
  ]
120
  ];
121
  let score = 0;
122
+
123
  const gameBoard = document.getElementById('game-board');
124
  const questionDisplay = document.getElementById('question-display');
125
  const scoreDisplay = document.getElementById('score');
126
+
127
  function createBoard() {
128
+ for (let row = 0; row < 3; row++) {
129
+ for (let col = 0; col < 5; col++) {
130
  const card = document.createElement('div');
131
  card.className = 'card';
132
+ card.textContent = `$${(row + 1) * 100}`;
133
+ card.onclick = () => showQuestion(col, row, card);
134
  gameBoard.appendChild(card);
135
  }
136
  }
137
  }
138
+
139
  function showQuestion(category, difficulty, cardElement) {
140
  if (cardElement.classList.contains('disabled')) return;
141
+
 
 
 
142
  const question = questions[category][difficulty];
143
+ let answerHtml = question.a.map((answer, index) =>
144
  `<button class="answer-btn" onclick="checkAnswer(${category}, ${difficulty}, ${index})">${answer}</button>`
145
  ).join('');
146
+
147
  questionDisplay.innerHTML = `
148
  <h2>${categories[category]} for $${(difficulty + 1) * 100}</h2>
149
  <p>${question.q}</p>
 
151
  `;
152
  cardElement.classList.add('disabled');
153
  cardElement.style.backgroundColor = '#cccccc';
 
154
  }
155
+
156
  function checkAnswer(category, difficulty, selectedAnswer) {
 
 
157
  const question = questions[category][difficulty];
158
  const isCorrect = selectedAnswer === question.correct;
159
  const value = (difficulty + 1) * 100;
160
+
161
+ score += isCorrect ? value : -value;
 
 
 
 
 
162
  scoreDisplay.textContent = `Score: ${score}`;
163
+ questionDisplay.innerHTML += `<p>${isCorrect ? 'Correct!' : 'Wrong!'}</p>`;
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
+
166
  createBoard();
167
  </script>
168
  </body>