From 37a8bfbda8b9ddc139178694599b791558d07e0b Mon Sep 17 00:00:00 2001 From: James Gayfer Date: Fri, 18 Aug 2017 18:39:40 -0700 Subject: [PATCH] HOTFIX - fix bug where setting timezone before setting a role wouldn't work --- CHANGELOG.md | 4 ++++ cogs/utils/constants.py | 2 +- db/dbase.py | 9 ++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 911c86b..fec570f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.5.2] - 2017-08-18 +### Fixed +- Bug where setting your timezone before assigning a role wouldn't work + ## [0.5.1] - 2017-08-12 ### Fixed - Countdown command was displaying incorrect values diff --git a/cogs/utils/constants.py b/cogs/utils/constants.py index 3ed6d5d..d168b67 100644 --- a/cogs/utils/constants.py +++ b/cogs/utils/constants.py @@ -3,7 +3,7 @@ import discord import pytz -VERSION = "0.5.1" +VERSION = "0.5.2" BLUE = discord.Colour(3381759) SPAM_DELAY = 4.5 REACTION_DELAY = 1 diff --git a/db/dbase.py b/db/dbase.py index f7c3615..5b1bdbb 100644 --- a/db/dbase.py +++ b/db/dbase.py @@ -47,12 +47,11 @@ def update_role(self, username, role, server_id): def update_timezone(self, username, timezone, server_id): sql = """ - UPDATE roster - SET timezone = %s - WHERE username = %s - AND server_id = %s; + INSERT INTO roster (username, timezone, server_id) + VALUES (%s, %s, %s) + ON DUPLICATE KEY UPDATE timezone = %s; """ - self.cur.execute(sql, (timezone, username, server_id)) + self.cur.execute(sql, (username, timezone, server_id, timezone)) self.conn.commit() def create_event(self, title, start_time, timezone, server_id, description, max_members):