Merge branch 'main' into release_1.1.1
This commit is contained in:
+10
-1
@@ -1398,6 +1398,15 @@ class NWProject():
|
|||||||
sessionFile = os.path.join(self.projMeta, nwFiles.SESS_STATS)
|
sessionFile = os.path.join(self.projMeta, nwFiles.SESS_STATS)
|
||||||
isFile = os.path.isfile(sessionFile)
|
isFile = os.path.isfile(sessionFile)
|
||||||
|
|
||||||
|
nowTime = time()
|
||||||
|
sessDiff = self.getSessionWordCount()
|
||||||
|
sessTime = nowTime - self.projOpened
|
||||||
|
|
||||||
|
logger.info("The session lasted %d sec and added %d words" % (int(sessTime), sessDiff))
|
||||||
|
if sessTime < 300 and sessDiff == 0:
|
||||||
|
logger.info("Session too short, skipping log entry")
|
||||||
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(sessionFile, mode="a+", encoding="utf8") as outFile:
|
with open(sessionFile, mode="a+", encoding="utf8") as outFile:
|
||||||
if not isFile:
|
if not isFile:
|
||||||
@@ -1410,7 +1419,7 @@ class NWProject():
|
|||||||
|
|
||||||
outFile.write("%-19s %-19s %8d %8d\n" % (
|
outFile.write("%-19s %-19s %8d %8d\n" % (
|
||||||
formatTimeStamp(self.projOpened),
|
formatTimeStamp(self.projOpened),
|
||||||
formatTimeStamp(time()),
|
formatTimeStamp(nowTime),
|
||||||
self.novelWCount,
|
self.novelWCount,
|
||||||
self.notesWCount,
|
self.notesWCount,
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -1073,7 +1073,6 @@ def testCoreProject_OldFormat(dummyGUI, nwOldProj):
|
|||||||
|
|
||||||
# Check that new files have been created
|
# Check that new files have been created
|
||||||
assert os.path.isfile(os.path.join(nwOldProj, "meta", "guiOptions.json"))
|
assert os.path.isfile(os.path.join(nwOldProj, "meta", "guiOptions.json"))
|
||||||
assert os.path.isfile(os.path.join(nwOldProj, "meta", "sessionStats.log"))
|
|
||||||
assert os.path.isfile(os.path.join(nwOldProj, "ToC.txt"))
|
assert os.path.isfile(os.path.join(nwOldProj, "ToC.txt"))
|
||||||
|
|
||||||
# END Test testCoreProject_OldFormat
|
# END Test testCoreProject_OldFormat
|
||||||
|
|||||||
Reference in New Issue
Block a user