Commit 978f0eea8803eddd561dfa727e6db121850d14a4

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

fixed some errors not being reported

show legend in topics table
modified looks of chapters
aprendizations/learnapp.py
... ... @@ -434,19 +434,19 @@ class LearnApp(object):
434 434 # makes factory for a single topic
435 435 # ------------------------------------------------------------------------
436 436 def factory_for(self, tref: str) -> Dict[str, QFactory]:
437   - factory: Dict[str, QFactory] = {}
  437 + factory: Dict[str, QFactory] = dict()
438 438 g = self.deps
439 439 t = g.nodes[tref] # get node
440   -
441 440 # load questions as list of dicts
442 441 topicpath: str = path.join(g.graph['prefix'], tref)
443 442 try:
444 443 fullpath: str = path.join(topicpath, t['file'])
445 444 except Exception:
446 445 msg1 = f'Invalid topic "{tref}"'
447   - msg2 = f'Check dependencies of {", ".join(g.successors(tref))}'
448   - raise LearnException(f'{msg1}. {msg2}')
449   -
  446 + msg2 = f'Check dependencies of: {", ".join(g.successors(tref))}'
  447 + msg = f'{msg1}. {msg2}'
  448 + logger.error(msg)
  449 + raise LearnException(msg)
450 450 logger.debug(f' Loading {fullpath}')
451 451 try:
452 452 questions: List[QDict] = load_yaml(fullpath)
... ... @@ -457,9 +457,9 @@ class LearnApp(object):
457 457 msg = f'Failed to load "{fullpath}"'
458 458 logger.error(msg)
459 459 raise LearnException(msg)
460   -
461 460 if not isinstance(questions, list):
462 461 msg = f'File "{fullpath}" must be a list of questions'
  462 + logger.error(msg)
463 463 raise LearnException(msg)
464 464  
465 465 # update refs to include topic as prefix.
... ...
aprendizations/templates/maintopics-table.html
... ... @@ -60,7 +60,21 @@
60 60  
61 61 <div id="notifications"></div>
62 62  
63   - <h4>{{ course['title'] }}</h4>
  63 + <div class="alert alert-warning alert-dismissible fade show" role="alert">
  64 + <p><strong>Legenda:</strong></p>
  65 + <p class="ml-3">
  66 + <i class="fas fa-book"></i> - Material de estudo<br>
  67 + <i class="fas fa-pencil-alt"></i> - Exercícios<br>
  68 + <i class="fas fa-puzzle-piece"></i> - Tópico que não faz parte dos objectivos deste curso mas que é necessário saber<br>
  69 + <i class="fas fa-flag"></i> - Milestone, terminou um certo conjunto de tópicos
  70 + </p>
  71 +
  72 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  73 + <span aria-hidden="true">&times;</span>
  74 + </button>
  75 + </div>
  76 +
  77 + <h4 class="p-4">{{ course['title'] }}</h4>
64 78  
65 79 <table class="table table-hover">
66 80 <thead class="">
... ... @@ -75,21 +89,21 @@
75 89 {% if t['level'] is None %}
76 90 <tr class="table-secondary">
77 91 <td>
78   - {% if t['type']=='chapter' %}
79   - <div class="text-muted lead">
80   - {{ t['name'] }}
81   - </div>
82   - {% elif t['type']=='learn' %}
83   - <div class="text-muted">
  92 + <div class="text-muted">
  93 + {% if t['ref'] not in course['goals'] %}
  94 + <i class="fas fa-puzzle-piece"></i>
  95 + {% end %}
  96 +
  97 + {% if t['type']=='chapter' %}
  98 + <i class="fas fa-flag"></i>
  99 + {% elif t['type']=='learn' %}
84 100 <i class="fas fa-book"></i>&nbsp;
85   - {{ t['name'] }}
86   - </div>
87   - {% else %}
88   - <div class="text-muted">
  101 + {% else %}
89 102 <i class="fas fa-pencil-alt"></i>&nbsp;
90   - {{ t['name'] }}
91   - </div>
92   - {% end %}
  103 + {% end %}
  104 +
  105 + {{ t['name'] }}
  106 + </div>
93 107 </td>
94 108 <td class="text-center">
95 109 <i class="fas fa-lock text-muted"></i>
... ... @@ -100,18 +114,19 @@
100 114  
101 115 <tr class="clickable-row " data-href="/topic/{{t['ref']}}">
102 116 <td class="text-primary">
  117 + {% if t['ref'] not in course['goals'] %}
  118 + <i class="fas fa-puzzle-piece"></i>
  119 + {% end %}
  120 +
103 121 {% if t['type']=='chapter' %}
104   - <h5>
105   - <i class="fas fa-flag-checkered"></i>&nbsp;
106   - {{ t['name'] }}
107   - </h5>
  122 + <i class="fas fa-flag-checkered"></i>&nbsp;
108 123 {% elif t['type']=='learn' %}
109 124 <i class="fas fa-book"></i>&nbsp;
110   - {{ t['name'] }}
111 125 {% else %}
112 126 <i class="fas fa-pencil-alt"></i>&nbsp;
113   - {{ t['name'] }}
114 127 {% end %}
  128 +
  129 + {{ t['name'] }}
115 130 </td>
116 131  
117 132 <td class="text-center">
... ...