def make_star_false(filesystem_id: str) -> None: source = get_source(filesystem_id) if not source.star: source_star = SourceStar(source) db.session.add(source_star) db.session.commit() source.star.starred = False
def make_star_true(filesystem_id: str) -> None: source = get_source(filesystem_id) if source.star: source.star.starred = True else: source_star = SourceStar(source) db.session.add(source_star)
def star_source(source: Source) -> None: """ Adds a SourceStar record for the source. """ star = SourceStar(source, True) db.session.add(star) db.session.commit()
def new_source_star(self, source_id): source = Source.query.get(source_id) star = SourceStar(source, bool_or_none()) db.session.add(star)
def new_source_star(self, source_id: int) -> None: source = Source.query.get(source_id) star = SourceStar(source, random.choice([True, False])) db.session.add(star)