aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar Evelyn2017-10-31 11:57:22 +0000
committerGravatar Evelyn2017-10-31 11:57:22 +0000
commite669b7c2e6a5084a56316ce7f58db9d898f5b614 (patch)
tree32b4aae17075b3c521a0ee37074a81928ec29770 /modules
parentNR: Full association summaries for SCHEDULE, LDB (diff)
signature
NR: Indicate direction for associations
Diffstat (limited to 'modules')
-rw-r--r--modules/nr.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/nr.py b/modules/nr.py
index a2daa428..d8554f47 100644
--- a/modules/nr.py
+++ b/modules/nr.py
@@ -390,7 +390,7 @@ class Module(object):
parsed_assoc = {
"uid_assoc": assoc.uid,
"category": {"divide": "VV", "join": "JJ", "next": "NP"}[assoc["category"]],
- "from": parsed["first"],
+ "from": parsed["first"], "direction": assoc["destTiploc"].rstrip()==parsed["tiploc"],
"origin_name": assoc["origin"], "origin_tiploc": assoc["originTiploc"],
"origin_crs": assoc["originCRS"] if "originCRS" in assoc else None,
@@ -400,8 +400,7 @@ class Module(object):
"far_name": assoc["destination"], "far_tiploc": assoc["destTiploc"],
"far_crs": assoc["destCRS"] if "destCRS" in assoc else None,
}
-
- if parsed["first"]:
+ if parsed_assoc["direction"]:
parsed_assoc.update({"far_name": parsed_assoc["origin_name"],
"far_tiploc": parsed_assoc["origin_tiploc"], "far_crs": parsed_assoc["origin_crs"]})
parsed["associations"].append(parsed_assoc)
@@ -430,7 +429,7 @@ class Module(object):
station["divide_summary"] = ""
for assoc in station["associations"]:
station["divide_summary"] += ", " if station["divide_summary"] else ""
- station["divide_summary"] += "{arrow} {assoc[category]} {assoc[uid_assoc]} {arrow} {assoc[far_name]} ({code})".format(assoc=assoc, arrow=assoc["from"]*"<-" or "->", code=assoc["far_crs"] or assoc["far_tiploc"])
+ station["divide_summary"] += "{arrow} {assoc[category]} {assoc[uid_assoc]} {dir_arrow} {assoc[far_name]} ({code})".format(assoc=assoc, arrow=assoc["from"]*"<-" or "->", dir_arrow=(assoc["direction"])*"<-" or "->", code=assoc["far_crs"] or assoc["far_tiploc"])
if station["passing"]:
station["times"]["arrival"]["status"], station["times"]["departure"]["status"] = 5, 5