Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rsammelson/new-timeclock
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: PhyXTGears-programming/new-timeclock
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Jan 14, 2020

  1. Copy the full SHA
    734b0e6 View commit details
Showing with 31 additions and 31 deletions.
  1. +2 −1 backend/timeFilesManager.py
  2. +25 −23 converter.py
  3. +4 −7 gui/guiMain.py
3 changes: 2 additions & 1 deletion backend/timeFilesManager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import time
import os

import backend.processOptions as opts
@@ -68,7 +69,7 @@ def getHours(user):
lines = userFile.readlines()[1:]

# Auto-clockout (prevents users from getting time from forgetting to sign out)
autoClockoutTime = datetime.time.fromisoformat(opts.timeclockOpts["autoClockoutTime"])
autoClockoutTime = time.strptime(opts.timeclockOpts["autoClockoutTime"], "%H:%M:%S")

try:
lastIO = rapidjson.loads(lines[-1], datetime_mode=DM_ISO8601)
48 changes: 25 additions & 23 deletions converter.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
import rapidjson
import datetime
import os

oldPath = "../timeclock/"
oldPath = "../oldData/"

def portUser(information):
oldFilename = userInfo[0].strip().replace(" ", "")
newFilename = userInfo[0].strip().lower().replace(" ", "_")

with open("times/" + newFilename + ".json", "w") as newFile:
data = {}
data["teams"] = [i.strip() for i in information[3].split(",")]
if information[3].strip() == "none":
data["teams"] = ["Other"]
data["role"] = information[2].strip()
newFile.write(rapidjson.dumps(data) + "\n")

with open(oldPath + "/times/" + oldFilename + ".txt") as oldFile:
for line in oldFile:
signIOData = line.split("|")
io = signIOData[0].strip()
if io == "@":
io = "o"
elif io == "!":
io = "i"

ioTime = datetime.datetime.strptime(signIOData[1].strip(), "%H:%M:%S %d.%m.%Y")

signData = {"type": io, "time": ioTime}
signDataJson = rapidjson.dumps(signData, datetime_mode=rapidjson.DM_ISO8601)
newFile.write(signDataJson)
newFile.write("\n")
if os.path.exists(oldPath + "times/" + oldFilename + ".txt"):
data = {}
data["teams"] = [i.strip() for i in information[3].split(",")]
# if information[3].strip() == "none":
# data["teams"] = ["Other"]
data["role"] = information[2].strip()
newFile.write(rapidjson.dumps(data) + "\n")

with open(oldPath + "times/" + oldFilename + ".txt") as oldFile:
for line in oldFile:
signIOData = line.split("|")
io = signIOData[0].strip()
if io == "@":
io = "o"
elif io == "!":
io = "i"

ioTime = datetime.datetime.strptime(signIOData[1].strip(), "%H:%M:%S %d.%m.%Y")

signData = {"type": io, "time": ioTime}
signDataJson = rapidjson.dumps(signData, datetime_mode=rapidjson.DM_ISO8601)
newFile.write(signDataJson)
newFile.write("\n")


if __name__ == "__main__":
11 changes: 4 additions & 7 deletions gui/guiMain.py
Original file line number Diff line number Diff line change
@@ -41,10 +41,7 @@ def startGUI():
mainLayout.addLayout(makeActions(app))

window.setLayout(mainLayout)
window.show()
print("1024 x 768")
print(window.width(), " x ", window.height())
print("", 1024 - window.width(), "\t", 768 - window.height())
window.showFullScreen()
app.exec_()


@@ -73,7 +70,7 @@ def makeTitle():
def makeNameArea():
tabs = QTabWidget()
tabs.setStyleSheet(
"QTabBar::tab {width: 150px; height:40px} QTabBar::scroller{width:50px;}")
"QTabBar::tab {width: 130px; height:40px} QTabBar::scroller{width:50px;}")

for i in opts.timeclockOpts["teams"]:
currentNames = []
@@ -243,9 +240,9 @@ def doIO(io):

actionsLayout.addWidget(signI, 0, 0, 3, 2)
actionsLayout.addWidget(signO, 0, 2, 3, 2)
# actionsLayout.addWidget(more, 0, 4, 2, 1)
actionsLayout.addWidget(more, 0, 4, 2, 1)
actionsLayout.addWidget(newUser, 2, 4)
# actionsLayout.addWidget(graph, 0, 5)
actionsLayout.addWidget(graph, 0, 5)
actionsLayout.addWidget(update, 1, 5)
actionsLayout.addWidget(quit, 2, 5)
return actionsLayout