Merge lp:~widelands-dev/widelands-website/fix_encyclopedia into lp:widelands-website

Proposed by kaputtnik
Status: Merged
Merged at revision: 487
Proposed branch: lp:~widelands-dev/widelands-website/fix_encyclopedia
Merge into: lp:widelands-website
Diff against target: 49 lines (+20/-5)
2 files modified
templates/wlhelp/workers.html (+16/-0)
wlhelp/management/commands/update_help.py (+4/-5)
To merge this branch: bzr merge lp:~widelands-dev/widelands-website/fix_encyclopedia
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+342023@code.launchpad.net

Description of the change

For the workers add a list showing, e.g.:

- At experience level 28 he will become: Master Miner
- Became of: Miner (at experience level 19)

There was a failure in the worker parser which leads the columns 'exp' and 'becomes' in the database empty. This branch fix this.

To post a comment you must log in.
490. By kaputtnik

added a comment

491. By kaputtnik

small html fix

Revision history for this message
GunChleoc (gunchleoc) wrote :

Looks good - just change the text a bit like I suggested in the bug.

review: Approve
492. By kaputtnik

changed a term

Revision history for this message
kaputtnik (franku) wrote :

Changed the term like you suggested, merged and deployed.

Thanks for the review :-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'templates/wlhelp/workers.html'
2--- templates/wlhelp/workers.html 2018-03-09 11:26:52 +0000
3+++ templates/wlhelp/workers.html 2018-03-26 16:08:06 +0000
4@@ -33,6 +33,22 @@
5 </td>
6 <td>
7 {{ worker.help }}
8+ {% if worker.becomes or worker.trained_by_experience%}
9+ <ul>
10+ {% if worker.becomes %}
11+ <li>At experience level {{ worker.exp }} he will become:
12+ <a href="#{{ worker.becomes.name }}">{{ worker.becomes.displayname}}</a>
13+ </li>
14+ {% endif %}
15+ {% if worker.trained_by_experience %}
16+ <li>
17+ Enhanced from: <a href="#{{ worker.trained_by_experience.name }}">
18+ {{ worker.trained_by_experience.displayname}}</a>
19+ (at experience level {{ worker.trained_by_experience.exp }})
20+ </li>
21+ {% endif %}
22+ </ul>
23+ {% endif %}
24 <div class="small scripting">Internal name: "{{ worker.name }}"</div>
25 </td>
26 <td> {# works at #}
27
28=== modified file 'wlhelp/management/commands/update_help.py'
29--- wlhelp/management/commands/update_help.py 2017-07-21 14:54:23 +0000
30+++ wlhelp/management/commands/update_help.py 2018-03-26 16:08:06 +0000
31@@ -172,14 +172,13 @@
32 # Help
33 workero.help = worker['helptext']
34
35- # Check for experience
36- if 'experience' in worker:
37- workero.exp = worker['experience']
38-
39 # See what the worker becomes
40 if 'becomes' in worker:
41 try:
42- enname = worker.becomes
43+ if worker['becomes']['experience']:
44+ workero.exp = worker['becomes']['experience']
45+
46+ # The worker this worker becomes to may wasn't created yet
47 workero.becomes = WorkerModel.objects.get_or_create(
48 name=worker['becomes']['name'], tribe=self._to)[0]
49 except:

Subscribers

People subscribed via source and target branches