Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit d371097

Browse files
committed
Fix: addbookauthor
1 parent 621db09 commit d371097

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

rsmanage/rsmanage.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,26 +1139,24 @@ def addbookauthor(config, book, author, github):
11391139
if not github:
11401140
github = f"https://github.com/RunestoneInteractive/{book}.git"
11411141

1142-
# Create an entry in book (document_id, github_url)
1142+
# create an entry in book_author (author, book)
11431143
try:
11441144
res = engine.execute(
1145-
f"""insert into book
1146-
(document_id, github_url)
1147-
values ( '{book}', '{github}' )
1145+
f"""
1146+
insert into library
1147+
(title, basecourse)
1148+
values ( 'Temporary title for {book}', '{book}' )
11481149
"""
11491150
)
1150-
except Exception as e:
1151-
click.echo(f"Book already exists in book table {e}")
1152-
# create an entry in book_author (author, book)
1153-
try:
11541151
res = engine.execute(
11551152
f"""insert into book_author
11561153
(author, book)
11571154
values ( '{author}', '{book}' )
11581155
"""
11591156
)
1160-
except:
1161-
click.echo(f"{author} is already an author for {book}")
1157+
1158+
except Exception as e:
1159+
click.echo(f"Error setting book,author pair {e}")
11621160

11631161
# create an entry in auth_membership (group_id, user_id)
11641162
auth_row = engine.execute(

0 commit comments

Comments
 (0)