diff --git a/prpr/cli.py b/prpr/cli.py index 708186c..cac44bd 100644 --- a/prpr/cli.py +++ b/prpr/cli.py @@ -23,10 +23,10 @@ def configure_arg_parser(): ) filters.add_argument( "-p", - "--problems", + "--projects", type=int, nargs="+", - help="the numbers of problems to be shown; multiple space-separated values are accepted", + help="the numbers of projects to be shown; multiple space-separated values are accepted", ) filters.add_argument( "-n", @@ -39,7 +39,13 @@ def configure_arg_parser(): "--student", help="the substring to be found in the student column, mail works best", ) - arg_parser.add_argument("-o", "--open", action="store_true", default=False, help="Open homework pages in browser") + arg_parser.add_argument( + "-o", + "--open", + action="store_true", + default=False, + help="Open the first homework in the list " + "in two tabs of default browser: tracker and reviewer") arg_parser.add_argument( "-v", "--verbose", diff --git a/prpr/filters.py b/prpr/filters.py index 510167f..9628208 100644 --- a/prpr/filters.py +++ b/prpr/filters.py @@ -36,7 +36,7 @@ def filter_homeworks( homeworks: list[Homework], *, mode: Mode, - problems: Optional[list[int]] = None, + projects: Optional[list[int]] = None, no: Optional[int] = None, student: Optional[str] = None, ) -> list[Homework]: @@ -57,8 +57,8 @@ def filter_homeworks( elif mode == Mode.CLOSED: result = _filter_homeworks_by_status(homeworks, CLOSED_STATUSES) - if problems: - result = [h for h in result if h.problem in problems] + if projects: + result = [h for h in result if h.project in projects] if student: result = [h for h in result if student in h.student] return result diff --git a/prpr/homework.py b/prpr/homework.py index 9d61b4b..5d00f65 100644 --- a/prpr/homework.py +++ b/prpr/homework.py @@ -57,7 +57,7 @@ def __init__( self.number = number self.status_updated = self._parse_datetime(status_updated) self.description = description - self.problem, self.student = self._extract_problem_and_student(summary) + self.project, self.student = self._extract_project_and_student(summary) self.status = Status.from_string(status) self.issue_key = issue_key @@ -130,12 +130,12 @@ def _compute_deadline(status_updated: Optional[datetime], status: Status) -> Opt return status_updated + timedelta(days=1) if status in {Status.OPEN} else None def __repr__(self) -> str: - return f"no {self.number}: {self.student} {self.problem} ({self.status})" + return f"no {self.number}: {self.student} {self.project} ({self.status})" @staticmethod - def _extract_problem_and_student(summary) -> Tuple[int, str]: - if m := re.match(r"\[(?P\d+)( \(back_cohort_(?P\d+)\))?\] (?P.*)", summary): - return int(m.group("problem")), m.group("student") + def _extract_project_and_student(summary) -> Tuple[int, str]: + if m := re.match(r"\[(?P\d+)( \(back_cohort_(?P\d+)\))?\] (?P.*)", summary): + return int(m.group("project")), m.group("student") raise ValueError(f"Couldn't parse summary '{summary}' 😿") @property diff --git a/prpr/main.py b/prpr/main.py index 3234349..40be6f9 100755 --- a/prpr/main.py +++ b/prpr/main.py @@ -46,7 +46,7 @@ def main(): filtered_homeworks = filter_homeworks( homeworks, mode=args.mode, - problems=args.problems, + projects=args.projects, no=args.no, student=args.student, ) diff --git a/prpr/table.py b/prpr/table.py index 4c22bde..379a09b 100644 --- a/prpr/table.py +++ b/prpr/table.py @@ -18,7 +18,7 @@ def print_issue_table(homeworks: list[Homework], last=None): str(table_number), homework.issue_url, str(homework.number), - str(homework.problem), + str(homework.project), homework.student, homework.pretty_status, homework.deadline_string,