Commit b264128e59e4314ac48d4f7cb4be189dc8f5c1a0

Authored by Miguel Barão
1 parent 66769475
Exists in master and in 1 other branch dev

- aprendizations without cmdline argument starts courses.yaml by default

- adds a warning message for textarea questions that have no tests
aprendizations/learnapp.py
... ... @@ -143,6 +143,9 @@ class LearnApp(object):
143 143 logger.error(f'Failed right answer in "{qref}".')
144 144 errors += 1
145 145 continue # to next test
  146 + elif q['type'] == 'textarea':
  147 + msg = f' consider adding tests to {q["ref"]}'
  148 + logger.warning(msg)
146 149  
147 150 if 'tests_wrong' in q:
148 151 for t in q['tests_wrong']:
... ...
aprendizations/main.py
... ... @@ -18,24 +18,29 @@ from . import APP_NAME, APP_VERSION
18 18 # ----------------------------------------------------------------------------
19 19 def parse_cmdline_arguments():
20 20 argparser = argparse.ArgumentParser(
21   - description='Server for online learning. Students and topics '
22   - 'have to be previously configured. Please read the documentation '
23   - 'included with this software before running the server.'
  21 + description='Webserver for interactive learning and practice. '
  22 + 'Please read the documentation included with this software before '
  23 + 'using it.'
24 24 )
25 25  
26 26 argparser.add_argument(
27   - 'courses', type=str, # nargs='*',
28   - help='Courses configuration file in YAML format.'
  27 + 'courses', type=str, nargs='?', default='courses.yaml',
  28 + help='configuration file in YAML format.'
  29 + )
  30 +
  31 + argparser.add_argument(
  32 + '-v', '--version', action='store_true',
  33 + help='show version information and exit'
29 34 )
30 35  
31 36 argparser.add_argument(
32 37 '--prefix', type=str, default='.',
33   - help='Path where the topic directories can be found (default: .)'
  38 + help='path where the topic directories can be found (default: .)'
34 39 )
35 40  
36 41 argparser.add_argument(
37 42 '--port', type=int, default=8443,
38   - help='Port to be used by the HTTPS server (default: 8443)'
  43 + help='port for the HTTPS server (default: 8443)'
39 44 )
40 45  
41 46 argparser.add_argument(
... ... @@ -44,18 +49,13 @@ def parse_cmdline_arguments():
44 49 )
45 50  
46 51 argparser.add_argument(
47   - '--check', action='store_true',
48   - help='Sanity check questions (can take awhile)'
  52 + '-c', '--check', action='store_true',
  53 + help='sanity check questions (can take awhile)'
49 54 )
50 55  
51 56 argparser.add_argument(
52 57 '--debug', action='store_true',
53   - help='Enable debug mode'
54   - )
55   -
56   - argparser.add_argument(
57   - '--version', action='store_true',
58   - help='Print version information'
  58 + help='enable debug mode'
59 59 )
60 60  
61 61 return argparser.parse_args()
... ... @@ -113,7 +113,7 @@ def main():
113 113 arg = parse_cmdline_arguments()
114 114  
115 115 if arg.version:
116   - print(f'{APP_NAME} - {APP_VERSION}\nPython {sys.version}')
  116 + print(f'{APP_NAME} {APP_VERSION}\nPython {sys.version}')
117 117 sys.exit(0)
118 118  
119 119 # --- Setup logging
... ...