← Back to team overview

widelands-dev team mailing list archive

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

 

kaputtnik has proposed merging lp:~widelands-dev/widelands-website/fix_encyclopedia into lp:widelands-website.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #336021 in Widelands Website: "the online-help shoud be enhanced"
  https://bugs.launchpad.net/widelands-website/+bug/336021

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/fix_encyclopedia/+merge/342023

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.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/fix_encyclopedia into lp:widelands-website.
=== modified file 'templates/wlhelp/workers.html'
--- templates/wlhelp/workers.html	2018-03-09 11:26:52 +0000
+++ templates/wlhelp/workers.html	2018-03-24 09:11:48 +0000
@@ -33,6 +33,20 @@
 			</td>
 			<td>
 				{{ worker.help }}
+				{% if worker.becomes %}
+				<ul>
+					<li>At experience level {{ worker.exp }} he will become:
+						<a href="#{{ worker.becomes.name }}">{{ worker.becomes.displayname}}</a>
+					</li>
+				{% endif %}
+				{% if worker.trained_by_experience %}
+					<li>
+						Became of: <a href="#{{ worker.trained_by_experience.name }}">
+						{{ worker.trained_by_experience.displayname}}</a>
+						(at experience level {{ worker.trained_by_experience.exp }})
+					</li>
+				</ul>
+				{% endif %}
 				<div class="small scripting">Internal name: "{{ worker.name }}"</div>
 			</td>
 			<td> {# works at #}

=== modified file 'wlhelp/management/commands/update_help.py'
--- wlhelp/management/commands/update_help.py	2017-07-21 14:54:23 +0000
+++ wlhelp/management/commands/update_help.py	2018-03-24 09:11:48 +0000
@@ -172,14 +172,12 @@
             # Help
             workero.help = worker['helptext']
 
-            # Check for experience
-            if 'experience' in worker:
-                workero.exp = worker['experience']
-
             # See what the worker becomes
             if 'becomes' in worker:
                 try:
-                    enname = worker.becomes
+                    if worker['becomes']['experience']:
+                        workero.exp = worker['becomes']['experience']
+
                     workero.becomes = WorkerModel.objects.get_or_create(
                         name=worker['becomes']['name'], tribe=self._to)[0]
                 except:


Follow ups