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

Commit c2b6f00

Browse files
authored
Merge branch 'main' into python-version-update
2 parents 252f55b + 38c0288 commit c2b6f00

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

bookserver/crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ async def fetch_one_user_topic_practice(
10741074
async with async_session() as session:
10751075
res = await session.execute(query)
10761076
rslogger.debug(f"{res=}")
1077-
utp = res.scalars().one_or_none()
1077+
utp = res.scalars().first()
10781078
return UserTopicPracticeValidator.from_orm(utp)
10791079

10801080

bookserver/internal/scheduled_builder.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def armv7_builder(
587587
def verilog_builder(
588588
file_path, cwd, sphinx_base_path, sphinx_source_path, sphinx_out_path, source_path
589589
):
590-
# Build the test code with a random verification code.
590+
# Preprocess the test code with a random verification code, so that the student's source code won't hae access to the verification code.
591591
out_list = []
592592
verification_code = get_verification_code()
593593
test_file_path = os.path.join(
@@ -612,7 +612,7 @@ def verilog_builder(
612612
out_list,
613613
)
614614

615-
# Compile the source and test code.
615+
# Compile the source and preprocessed test code.
616616
exe_path = file_path + ".exe"
617617
report_subprocess(
618618
[
@@ -627,6 +627,11 @@ def verilog_builder(
627627
out_list,
628628
)
629629

630+
# Copy over any test vectors.
631+
copy_test_file_to_tmp(
632+
file_path, cwd, sphinx_base_path, sphinx_source_path, source_path, ".txt"
633+
)
634+
630635
# Run the simulation.
631636
report_subprocess(
632637
runguard([exe_path], cwd, memsize_kb=100000),

bookserver/internal/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def canonicalize_tz(tstring: str) -> str:
4848
def make_json_response(
4949
status: int = status.HTTP_200_OK, detail: Any = None
5050
) -> JSONResponse:
51-
# Omit the detail if it's none.
51+
# content is a required parameter for a JSONResponse
5252
return JSONResponse(
5353
status_code=status, content=jsonable_encoder({"detail": detail})
5454
)

bookserver/routers/books.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def return_static_asset(course, kind, filepath):
8686
filepath,
8787
)
8888
rslogger.debug(f"GETTING: {filepath}")
89-
if os.path.exists(filepath):
89+
if os.path.exists(filepath) and not os.path.isdir(filepath):
9090
return FileResponse(filepath)
9191
else:
9292
raise HTTPException(404)
@@ -306,8 +306,12 @@ async def serve_page(
306306
rslogger.debug(f"After user check rs_banner is {show_rs_banner}")
307307

308308
worker_name = os.environ.get("WORKER_NAME", socket.gethostname())
309-
# temporary
310-
if course_attrs.get("ad_server", "google") == "ethical":
309+
if worker_name == "":
310+
worker_name = socket.gethostname()
311+
312+
# This makes serving ethical ads the default, but it can be overridden
313+
# by adding a course attribute for the base course to set the ad_server to google
314+
if course_attrs.get("ad_server", "ethical") == "ethical":
311315
serve_google_ad = False
312316
else:
313317
serve_google_ad = serve_ad

bookserver/routers/rslogging.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,10 @@ async def updatelastpage(
267267
RS_info: Optional[str] = Cookie(None),
268268
):
269269
if request_data.last_page_url is None:
270+
# This really should never be the case, but...
270271
rslogger.error(f"No data for last page url {request_data}")
271272
return make_json_response(detail="No Data")
272-
# todo: log request_data, request.args and request.env.path_info
273+
273274
if request.state.user:
274275
lpd = request_data.dict()
275276
rslogger.debug(f"{lpd=}")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# ================
1111
[tool.poetry]
1212
name = "bookserver"
13-
version = "1.3.12"
13+
version = "1.3.14"
1414
description = "A new Runestone Server Framework"
1515
authors = ["Brad Miller <[email protected]>", "Bryan A. Jones <bjones AT ece DOT msstate DOT edu"]
1616
license = "MIT"

0 commit comments

Comments
 (0)