Skip to content

Commit

Permalink
fix #114
Browse files Browse the repository at this point in the history
  • Loading branch information
obar1 authored Aug 20, 2024
1 parent f9e08ef commit 54f4be6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
9 changes: 6 additions & 3 deletions zero_to_one_hundred/models/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ def __repr__(self):

def get_sections(self):

res :List[Section] = self.sections
if self.config_map.get_repo_sorted == "abc":
return sorted(self.sections, key=str)
print('*** abc')
res= sorted(self.sections, key=lambda s: s.dir_name)
if self.config_map.get_repo_sorted == "00:00:00":
return sorted(self.sections, key=lambda s: s.get_readme_md_time())
return self.sections
print('*** 00:00:00')
res = sorted(self.sections, key=lambda s: s.get_readme_md_time())
return res

def asMarkDown(self) -> str:
lf_char = "\n"
Expand Down
2 changes: 1 addition & 1 deletion zero_to_one_hundred/models/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def write_done_section(self):

def get_readme_md_time(self):
return self.persist_fs.get_biz_ts(
self.config_map.get_repo_path + "/" + self.dir_name
self.dir_readme_md
)

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion zero_to_one_hundred/repository/a_persist_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def make_dirs(cls, path):

@classmethod
def read_file(cls, filename) -> List[str] | None:
print(f"read_file {filename}")
# print(f"read_file {filename}")
lines = None
try:
with open(filename, mode="r", encoding="UTF-8") as f:
Expand Down
16 changes: 9 additions & 7 deletions zero_to_one_hundred/repository/ztoh_persist_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,32 @@ def done_section(cls, path):
path = cls.abs_path(path)
print(f"done_section {path}")
path = path + os.sep + ".done"
print(f"path {path}")
# print(f"path {path}")
os.makedirs(path, 0o777, True)
with open("{}/.gitkeep".format(path), "a", encoding="utf-8"):
os.utime("{}/.gitkeep".format(path), None)
print(f"created {path}")

@classmethod
def done_section_status(cls, abs_repo_path, path):
print(f"done_section_status {path}")
# print(f"done_section_status {path}")
path = abs_repo_path + os.sep + path + os.sep + ".done"
print(f"path {path}")
# print(f"path {path}")
exists = os.path.exists(path)
print(f"exists {exists}")
# print(f"exists {exists}")
if exists:
return True
return False

@classmethod
def get_biz_ts(cls, path):

print(f"path {path}")
# print(f"path {path}")
exists = os.path.exists(path)
print(f"exists {exists}")
# print(f"exists {exists}")

if exists:
return os.path.getatime(path)
res = os.path.getmtime(path)
# print(f"time {path} {res}")
return res
return time.time()

0 comments on commit 54f4be6

Please sign in to comment.