From af68db6b0866e188e6784f5b121318b4fb2aaa13 Mon Sep 17 00:00:00 2001 From: Arnold Kocsis Date: Thu, 13 Feb 2020 12:30:41 +0000 Subject: [PATCH] Removed unneeded code --- locations-jinja.py | 60 +-------------------------------------------- locations.db | Bin 20480 -> 24576 bytes 2 files changed, 1 insertion(+), 59 deletions(-) diff --git a/locations-jinja.py b/locations-jinja.py index c6a7192..77cc32a 100644 --- a/locations-jinja.py +++ b/locations-jinja.py @@ -18,70 +18,12 @@ class LocationsWebsite(object): def get_locations(self): locations = self.get_filtered_data() -# latitudes = self.get_latitudes() -# longitudes = self.get_longitudes() -# dates = self.get_dates() -# #times = [time[:-7] for time in self.get_times()] -# tids = self.get_tids() -# times = self.get_report_times() -# for i in range(len(latitudes)): -# locations.append([longitudes[i],latitudes[i],dates[i],times[i],tids[i]]) #make list of lists to enable jinja render as columns return locations - - def get_latitudes(self): - latitudes = [] - with sql.connect(DB) as cur: - results = cur.execute('''SELECT latitude FROM Location ORDER BY tid DESC;''') - for latitude, in results: - latitudes.append(str(latitude)) - return latitudes - - def get_longitudes(self): - longitudes = [] - with sql.connect(DB) as cur: - results = cur.execute('''SELECT longitude FROM Location ORDER BY tid DESC;''') - for longitude, in results: - longitudes.append(str(longitude)) - return longitudes - - def get_dates(self): - dates = [] - with sql.connect(DB) as cur: - results = cur.execute('''SELECT date FROM Location ORDER BY tid DESC;''') - for date, in results: - readabledate = time.strftime('%Y-%m-%d', time.localtime(date)) - dates.append(str(readabledate)) - return dates - - def get_times(self): - times = [] - with sql.connect(DB) as cur: - results = cur.execute('''SELECT time FROM Location ORDER BY tid DESC;''') - for time, in results: - times.append(str(time)) - return times - - def get_tids(self): - tids = [] - with sql.connect(DB) as cur: - results = cur.execute('''SELECT tid FROM Location ORDER BY tid DESC;''') - for tid, in results: - tids.append(str(tid)) - return tids - - def get_report_times(self): - times = [] - with sql.connect(DB) as cur: - results = cur.execute('''SELECT time FROM Location ORDER BY tid DESC;''') - for Time, in results: - readabletime = time.strftime('%H:%M:%S', time.localtime(Time)) - times.append(str(readabletime)) - return times def get_filtered_data(self): all_data = [] with sql.connect(DB) as cur: - results = cur.execute('''SELECT DISTINCT * FROM Location ORDER BY tid DESC;''') + results = cur.execute('''SELECT * FROM Location GROUP BY longitude, latitude,date,tid HAVING COUNT(*) > 1 ORDER BY tid DESC;''') for val1,val2,val3,val4,val5, in results: #rename vals to actual lon = val1 lat = val2 diff --git a/locations.db b/locations.db index 2ba4f4e7bf386423d404498218d2e4318e953baa..c3447b28e73af22c6c60e23218f0df575ac2941f 100644 GIT binary patch delta 3466 zcmcJRdsJ0b9>>o)_x(H~AW9(TUPMIYO{fUL?MBJH0s@(u!}Za_2O?fUQv@&UlclxH za986RYnf#&V>K2_o2DsHS!%jwrORn%D#v_O3bt%|ERAWYIltf8?CT8UUGq=<@jGA6 z+28a1?Y%kod`{cTV%q`n*?6PaB?yACL%B;5ySnD@lASvFTeu<^Gn`@hFi?#k>Jz;&*y2<*e)oWEOH!PR- z1T7Vo2^O>Yg1Ohc!`xz?W6n26o4zxBWa>06c+&K+$zvLAyk`8=_>OU_vB5aqm}WE@ zzBC*#ykuxL%rfK|qV)gN|5?9Vzd^rHU#w5i{iOT5Zm;fHUA@kyOV#P6^HPtrU0Nf} zlyW3lyeu9QUl&zzzE~v23j-aVXq`gJ>A6fLq>$-GlS!|S+W#+ccgN$dg(be+ueV2k zlNcz?Zo{gsR){}rIaB_|wnDJF*GQXh`s4Vai=$i?L{B z>*A6SbUJ$U+$9(i8cpC+`e}D&!khb{kt^@mr{@Frlz)tsKSd$q>4H?aA&tp6CaFxu zGD%@FhDkCLHxm~Pj)U73CP{Q>E}V^~#|l9b>1C7zDi?v=L5tEr;^~Y$kWsW9&qmVi zI2K2HieS1U_;hbxZ>ajP5jOq%wfBei1w7t$SiW+F#L}C2t`La{@8Ic9=ND1nyx6!o z2cChf9a#7rM29Uyej!;6U}?bTb~x|%^O^qH-e(}?e6w_|Hc*(Bg;n-|LZZ0k=79hD zt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