Fix for players not removed from online

utcnow instead of just now in datetimes
Signup not fits on windows client with message
This commit is contained in:
perast
2020-11-08 23:08:18 +01:00
parent 40af70d5ae
commit 1ee8f601a9
3 changed files with 17 additions and 18 deletions
+10 -12
View File
@@ -10,41 +10,39 @@
</head>
<body>
<div class="container-fluid">
<h1>Sign up</h1>
<h3>Sign up</h2>
<form id="signup" action="{{ url_for('signup') }}" method="post">
<div class="row">
<div class="col-md-4">
<label>Username</label>
<input type="text" id="username" name="username" class="form-control">
<input type="text" id="username" name="username" class="form-control form-control-sm">
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="col-xs-4 col-sm-4 col-md-4">
<label>Password</label>
<input type="password" id="password" name="password" class="form-control">
<input type="password" id="password" name="password" class="form-control form-control-sm">
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="col-xs-4 col-sm-4 col-md-4">
<label>Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password" class="form-control">
<input type="password" id="confirm_password" name="confirm_password" class="form-control form-control-sm">
</div>
</div>
<div class="row">
<div class="col-md-4">
<label>First name</label>
<input type="text" id="first_name" name="first_name" class="form-control">
<input type="text" id="first_name" name="first_name" class="form-control form-control-sm">
</div>
</div>
<div class="row">
<div class="col-md-4">
<label>Last name</label>
<input type="text" id="last_name" name="last_name" class="form-control">
<input type="text" id="last_name" name="last_name" class="form-control form-control-sm">
</div>
</div>
<div class="row">
<div class="col-md-12 top-buffer">
<input type="submit" value="Sign up" class="btn btn-outline-primary"><a href="{{ url_for('login') }}" class="btn btn-outline-danger">Back</a>
<input type="submit" value="Sign up" class="btn btn-sm btn-outline-primary"><a href="{{ url_for('login') }}" class="btn btn-sm btn-outline-danger">Back</a>
</div>
</div>
</form>
@@ -52,7 +50,7 @@
{% if messages %}
<ul class="list-group top-buffer">
{% for message in messages %}
<li class="list-group-item">{{ message }}</li>
<li class="list-group-item py-2">{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
+1 -1
View File
@@ -16,7 +16,7 @@ MAPS = [ 'FRANCE' ] + [ 'INNSBRUCK' ] + [ 'LONDON' ] * 2 + [ 'NEWYORK' ] * 2 + [
dom = minidom.parseString('<MapSchedule><appointments></appointments><VERSION>1</VERSION></MapSchedule>')
appts = dom.getElementsByTagName('appointments')[0]
now = datetime.datetime.now()
now = datetime.datetime.utcnow()
prev_map = None
for i in range(0, 500):
map_choice = random.choice(MAPS)
+6 -5
View File
@@ -442,7 +442,7 @@ def api_users_login():
@login_required
def api_users_logout():
#Remove player from online when leaving game/world
player_id = current_user.player_id
player_id = str(current_user.player_id)
if player_id in online:
online.pop(player_id)
if player_id in playerPartialProfiles:
@@ -550,6 +550,7 @@ def api_profiles_me():
elif current_user.player_id != profile.id:
# Update AnonUser's player_id to match
AnonUser.player_id = profile.id
ghostsEnabled[str(profile.id)] = AnonUser.enable_ghosts
if not profile.email:
profile.email = 'user@email.com'
if profile.f60:
@@ -803,7 +804,7 @@ def unix_time_millis(dt):
def fill_in_goal_progress(goal, player_id):
cur = g.db.cursor()
now = datetime.datetime.now()
now = datetime.datetime.utcnow()
if goal.periodicity == 0: # weekly
first_dt, last_dt = get_week_range(now)
else: # monthly
@@ -859,7 +860,7 @@ def api_profiles_goals(player_id):
goal = goal_pb2.Goal()
goal.ParseFromString(request.stream.read())
goal.id = get_id('goal')
now = datetime.datetime.now()
now = datetime.datetime.utcnow()
goal.created_on = unix_time_millis(now)
set_goal_end_date(goal, now)
fill_in_goal_progress(goal, player_id)
@@ -876,7 +877,7 @@ def api_profiles_goals(player_id):
goal = goals.goals.add()
row_to_protobuf(row, goal)
end_dt = datetime.datetime.fromtimestamp(goal.period_end_date / 1000)
now = datetime.datetime.now()
now = datetime.datetime.utcnow()
if end_dt < now:
set_goal_end_date(goal, now)
update_protobuf_in_db('goal', goal, goal.id)
@@ -1115,7 +1116,7 @@ def handle_segment_results(request):
result.ParseFromString(request.stream.read())
result.id = get_id('segment_result')
result.world_time = world_time()
result.finish_time_str = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
result.finish_time_str = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
result.f20 = 0
insert_protobuf_into_db('segment_result', result)
return '{"id": %ld}' % result.id, 200