我正在创建一个包含2个实体列表的表单。
一个列表包含具有Id和Name的实体,我们称之为 X 。我的其他列表,我们称之为 Y ,包含 UserId , X_Id 和得分。
由于 Y 列表不包含所有相应的,我需要在我的树枝模板中循环 X 列表,并且仅填充 Y < / strong>实体我想根据 X_id 显示分数。
现在我想检查 X_id 是否有 X 条目。我当然可以在每个 X 项目上循环 Y 列表,但是没有更好的方法可以做到这一点吗?
我有以下代码,显然这不起作用:
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [debug] dataDir set to: /data/local/tmp
info: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (
`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST
/FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /
PID %a))
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\
/local\/tmp"}
info: No old chromedrivers seemed to exist
info: Spawning chromedriver with: C:\Appium\node_modules\appium\build\chromedriv
er\windows\chromedriver.exe --url-base=wd/hub --port=9515
info: [CHROMEDRIVER STDOUT] Starting ChromeDriver 2.15.322448 (52179c1b310fec179
7c81ea9a20326839860b7d3) on port 9515
Only local connections are allowed.
info: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with n
o body
info: Got response with status 200: {"sessionId":"","status":0,"value":{"build":
{"version":"alpha"},"os":{"arch":"x86_64","name":"Windows NT","version":"6.1 SP1
"}}}
info: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] wi
th body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.
chrome","androidDeviceSerial":"08d257330222a227"}}}
info: Got response with status 200: {"sessionId":"f5ce7ed1b154d5ac6ec8b21724f707
47","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"b
rowserConnectionEnabled":false,"browserName":"chrome","chrome":{},"cssSelect...
info: [debug] Overriding session id with "f5ce7ed1b154d5ac6ec8b21724f70747"
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId f5ce7ed1b154d5ac6ec8b21724f7
0747
info: <-- POST /wd/hub/session 303 8913.062 ms - 70
info: --> GET /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747 {}
info: Proxying [GET /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747] to [GET ht
tp://127.0.0.1:9515/wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747] with body:
{}
info: Got response with status 200: {"sessionId":"f5ce7ed1b154d5ac6ec8b21724f707
47","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"b
rowserConnectionEnabled":false,"browserName":"chrome","chrome":{},"cssSelect...
info: <-- GET /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747 200 7.688 ms - 50
6
info: --> GET /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747/contexts {}
info: Available contexts: NATIVE_APP,WEBVIEW_1
info: [debug] Responding to client with success: {"status":0,"value":["NATIVE_AP
P","WEBVIEW_1"],"sessionId":"f5ce7ed1b154d5ac6ec8b21724f70747"}
info: <-- GET /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747/contexts 200 6.78
1 ms - 94 {"status":0,"value":["NATIVE_APP","WEBVIEW_1"],"sessionId":"f5ce7ed1b1
54d5ac6ec8b21724f70747"}
info: --> POST /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747/context {"name":
"NATIVE_APP"}
info: Available contexts: NATIVE_APP,WEBVIEW_1
info: Set mode: Proxying to Appium Bootstrap
info: [debug] Responding to client with success: {"status":0,"value":null,"sessi
onId":"f5ce7ed1b154d5ac6ec8b21724f70747"}
info: <-- POST /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747/context 200 12.4
95 ms - 72 {"status":0,"value":null,"sessionId":"f5ce7ed1b154d5ac6ec8b21724f7074
7"}
info: --> POST /wd/hub/session/f5ce7ed1b154d5ac6ec8b21724f70747/element {"using"
:"css selector","value":"*[name=\"Activate\"]","locator":"css selector"}
info: [debug] Invalid locator strategy: css selector
info: [debug] Responding to client with error: {"status":9,"value":{"message":"I
nvalid locator strategy: css selector","origValue":"Invalid locator strategy: cs
s selector"},"sessionId":"f5ce7ed1b154d5ac6ec8b21724f70747"}