rework selection of writeup folders: no ignore list
This commit is contained in:
parent
98e661f571
commit
ce0b8edf47
1 changed files with 8 additions and 4 deletions
|
@ -9,8 +9,13 @@ class ExerciseWriteUp(FileHandle):
|
|||
def __init__(self, root_dir: Path, course):
|
||||
self.root_dir = root_dir
|
||||
self.course = course
|
||||
FileHandle.__init__(self, next(self.root_dir.rglob('*.tex')), FileType.tex)
|
||||
|
||||
try:
|
||||
tex_file = next(self.root_dir.rglob('*.tex'))
|
||||
except StopIteration:
|
||||
print("No valid '.tex' file found in directory {}, can't instantiate write up here".format(root_dir))
|
||||
# TODO: raise proper error
|
||||
exit(1)
|
||||
FileHandle.__init__(self, tex_file, FileType.tex)
|
||||
|
||||
class Exercise:
|
||||
def __init__(self, course, number: int):
|
||||
|
@ -52,7 +57,6 @@ class Exercises(list):
|
|||
self._solutions = None
|
||||
self._writeups = None
|
||||
self._sheets = Files(self.sheet_root)
|
||||
self.ignored_folders = [self.sheet_root, self.solutions_root, self.root / 'LatexPackagesBuild', self.root / '.git']
|
||||
list.__init__(self, (Exercise(self.course, num) for num in map(lambda s: s.number, self._sheets)))
|
||||
|
||||
@property
|
||||
|
@ -68,7 +72,7 @@ class Exercises(list):
|
|||
@property
|
||||
def writeups(self):
|
||||
if not self._writeups:
|
||||
dirs = list(d for d in self.root.iterdir() if d.is_dir() and d not in self.ignored_folders)
|
||||
dirs = [d for d in self.root.glob('ub*') if d.is_dir()]
|
||||
self._writeups = sorted((ExerciseWriteUp(d, self.course) for d in dirs), key=lambda e: e.number)
|
||||
return self._writeups
|
||||
|
||||
|
|
Loading…
Reference in a new issue