Skip to content

Commit 48245ac

Browse files
committed
Improve contest ID handling in submit client.
This would have made debugging at EUC a bit easier.
1 parent 57fed82 commit 48245ac

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

submit/submit

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,21 @@ def get_epilog():
245245
contests_part_one = None
246246
contests_part_two = None
247247

248-
if not contests or len(contests) <= 1:
248+
if contest_id:
249249
contests_part_one = '''For CONTEST use the ID or short name as shown in the top-right contest
250-
drop-down box in the web interface.'''
251-
if contests and len(contests) == 1:
252-
contests_part_two = f"Currently this defaults to the only active contest '{contests[0]['shortname']}'"
250+
drop-down box in the web interface.'''
251+
contests_part_two = f"Currently defaults to '{contest_id}', pass '-c <contest_id>' to override."
253252
else:
254-
contests_part_one = 'For CONTEST use one of the following:'
255-
max_length = max([len(c['shortname']) for c in contests])
256-
for contest in contests:
257-
contests_part_one += f"\n {contest['shortname']:<{max_length}} - {contest['name']}"
253+
if not contests or len(contests) <= 1:
254+
contests_part_one = '''For CONTEST use the ID or short name as shown in the top-right contest
255+
drop-down box in the web interface.'''
256+
if contests and len(contests) == 1:
257+
contests_part_two = f"Currently this defaults to the only active contest '{contests[0]['shortname']}'"
258+
else:
259+
contests_part_one = 'For CONTEST use one of the following:'
260+
max_length = max([len(c['shortname']) for c in contests])
261+
for contest in contests:
262+
contests_part_one += f"\n {contest['shortname']:<{max_length}} - {contest['name']}"
258263

259264
if not problems:
260265
problem_part = 'For PROBLEM use the label as on the scoreboard.'
@@ -459,6 +464,8 @@ if args.url:
459464
baseurl = args.url
460465
elif 'SUBMITBASEURL' in os.environ:
461466
baseurl = os.environ['SUBMITBASEURL']
467+
logging.warning(f"Using '{baseurl}' as defined in the 'SUBMITBASEURL' environment variable. "
468+
+ "Pass '-u <url>' to override.")
462469
# Make sure that baseurl terminates with a '/' for later concatenation.
463470
if baseurl and baseurl[-1:] != '/':
464471
baseurl += '/'
@@ -467,6 +474,8 @@ if args.contest:
467474
contest_id = args.contest
468475
elif 'SUBMITCONTEST' in os.environ:
469476
contest_id = os.environ['SUBMITCONTEST']
477+
logging.warning(f"Using '{contest_id}' as defined in the 'SUBMITCONTEST' environment variable. "
478+
+ "Pass '-c <contest_id>' to override.")
470479
else:
471480
contest_id = ''
472481

0 commit comments

Comments
 (0)