fix style

This commit is contained in:
Radek
2024-12-17 12:41:23 +00:00
parent ca9de4592f
commit f20a7f0c34
3 changed files with 49 additions and 34 deletions

28
app.py
View File

@@ -38,27 +38,41 @@ def fetch_random_org_numbers(count, min_value, max_value):
# Function to generate lottery numbers based on rules
def generate_lottery_numbers(game_type, lines):
results = []
random_org_failure = False
for _ in range(lines):
if game_type == 'euromillions':
numbers = fetch_random_org_numbers(5, 1, 50) or sorted(secrets.SystemRandom().sample(range(1, 51), 5))
lucky_stars = fetch_random_org_numbers(2, 1, 12) or sorted(secrets.SystemRandom().sample(range(1, 13), 2))
numbers = fetch_random_org_numbers(5, 1, 50)
if numbers is None:
random_org_failure = True
numbers = sorted(secrets.SystemRandom().sample(range(1, 51), 5))
lucky_stars = fetch_random_org_numbers(2, 1, 12)
if lucky_stars is None:
random_org_failure = True
lucky_stars = sorted(secrets.SystemRandom().sample(range(1, 13), 2))
results.append({'numbers': numbers, 'lucky_stars': lucky_stars})
elif game_type == 'lotto':
numbers = fetch_random_org_numbers(6, 1, 47) or sorted(secrets.SystemRandom().sample(range(1, 48), 6))
numbers = fetch_random_org_numbers(6, 1, 47)
if numbers is None:
random_org_failure = True
numbers = sorted(secrets.SystemRandom().sample(range(1, 48), 6))
results.append({'numbers': numbers})
elif game_type == 'eurodreams':
numbers = fetch_random_org_numbers(6, 1, 40) or sorted(secrets.SystemRandom().sample(range(1, 41), 6))
numbers = fetch_random_org_numbers(6, 1, 40)
if numbers is None:
random_org_failure = True
numbers = sorted(secrets.SystemRandom().sample(range(1, 41), 6))
dream_number = fetch_random_org_numbers(1, 1, 5)
dream_number = dream_number[0] if dream_number else secrets.SystemRandom().randint(1, 5)
results.append({'numbers': numbers, 'dream_number': dream_number})
else:
return {'error': 'Invalid game type'}
return results
return results, random_org_failure
@app.route('/', methods=['GET', 'POST'])
def index():
result = None
random_org_failed = False
game_type = session.get('game_type', 'euromillions') # Default to EuroMillions
lines = session.get('lines', 1) # Default to 1 line
@@ -67,9 +81,9 @@ def index():
lines = int(request.form.get('lines', 1))
session['game_type'] = game_type
session['lines'] = lines
result = generate_lottery_numbers(game_type, lines)
result, random_org_failed = generate_lottery_numbers(game_type, lines)
return render_template('index.html', result=result, game_type=game_type, lines=lines)
return render_template('index.html', result=result, game_type=game_type, lines=lines, random_org_failed=random_org_failed)
if __name__ == '__main__':
app.run(debug=True)

View File

@@ -1,19 +1,17 @@
body {
font-family: Arial, sans-serif;
background-color: #f0f8ff;
background-color: #f4f4f9;
color: #333;
text-align: center;
margin: 0;
padding: 0;
}
.container {
max-width: 600px;
margin: 50px auto;
max-width: 600px;
padding: 20px;
background-color: #ffffff;
background: #fff;
border-radius: 8px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
h1 {
@@ -21,24 +19,27 @@ h1 {
}
form {
margin-top: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
label {
font-weight: bold;
margin-top: 10px;
}
select, button {
padding: 10px;
select, input, button {
margin-top: 10px;
padding: 10px;
width: 80%;
border-radius: 5px;
border: 1px solid #ccc;
width: 100%;
}
button {
background-color: #0073e6;
color: #fff;
color: white;
cursor: pointer;
}
@@ -46,9 +47,20 @@ button:hover {
background-color: #005bb5;
}
.result {
margin-top: 30px;
padding: 20px;
.results {
margin-top: 20px;
padding: 15px;
background-color: #f9f9f9;
border-radius: 8px;
border-radius: 5px;
}
.line {
margin: 5px 0;
font-size: 16px;
}
.error {
color: red;
font-weight: bold;
margin-top: 10px;
}

View File

@@ -4,18 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Lottery Number Generator</title>
<style>
body { font-family: Arial, sans-serif; background-color: #f4f4f9; color: #333; text-align: center; }
.container { margin: 50px auto; max-width: 600px; padding: 20px; background: #fff; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); }
h1 { color: #0073e6; }
form { display: flex; flex-direction: column; align-items: center; }
label { font-weight: bold; margin-top: 10px; }
select, input, button { margin-top: 10px; padding: 10px; width: 80%; border-radius: 5px; border: 1px solid #ccc; }
button { background-color: #0073e6; color: white; cursor: pointer; }
button:hover { background-color: #005bb5; }
.results { margin-top: 20px; padding: 15px; background-color: #f9f9f9; border-radius: 5px; }
.line { margin: 5px 0; font-size: 16px; }
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">