Commit 3549fb7ecfb06a5968db86e793cf90b673639e44

Authored by kristinlaahneolsen
1 parent d86f749b

Glemte å branche ut fra master. Oppdaterte spinnerne når man redigerer en vurder…

…ing. Oppdaget at konsekvens alltid sto som ufarlig og sannsynlighet på lav, så hvis ikke brukeren var obs på dette når han/hun redigerte en vurdering, så ville vurderingen på disse verdiene
Risiko/app/src/main/java/activity/EditEvaluation.java
... ... @@ -53,7 +53,7 @@ public class EditEvaluation extends AppCompatActivity {
53 53 int consequence = b.getInt("consequence");
54 54 int probability = b.getInt("probability");
55 55 String assosiatedActivity = b.getString("associatedActivity");
56   - setupSpinners();
  56 + setupSpinners(consequence, probability);
57 57  
58 58  
59 59 etTitle = findViewById(R.id.et_editEval_title);
... ... @@ -68,6 +68,7 @@ public class EditEvaluation extends AppCompatActivity {
68 68 etMeasures.setText(measures);
69 69  
70 70  
  71 +
71 72 editEvaluation.setOnClickListener(view -> {
72 73 if (inputAccepted()) {
73 74 String stringConsequence = spinnerConsequence.getSelectedItem().toString();
... ... @@ -159,16 +160,19 @@ public class EditEvaluation extends AppCompatActivity {
159 160 return true;
160 161 }
161 162  
162   - private void setupSpinners() {
  163 + private void setupSpinners(int consequence, int probability) {
163 164 spinnerConsequence = findViewById(R.id.spinner_consequence);
164 165 ArrayAdapter<CharSequence> consequenceAdapter = ArrayAdapter.createFromResource(this, R.array.consequence_array, android.R.layout.simple_spinner_item);
165 166 consequenceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
166 167 spinnerConsequence.setAdapter(consequenceAdapter);
  168 + spinnerConsequence.setSelection(consequence - 1);
  169 +
167 170  
168 171 spinnerProbability = findViewById(R.id.spinner_probability);
169 172 ArrayAdapter<CharSequence> probabilityAdapter = ArrayAdapter.createFromResource(this, R.array.probability_array, android.R.layout.simple_spinner_item);
170 173 consequenceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
171 174 spinnerProbability.setAdapter(probabilityAdapter);
  175 + spinnerProbability.setSelection(probability - 1);
172 176 }
173 177  
174 178 private int getConsequenceValue(String consequence) {
... ...
restApi/.idea/workspace.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <project version="4">
3 3 <component name="ChangeListManager">
4   - <list default="true" id="0e20d303-9de8-4113-bfd9-019e72b304dc" name="Default" comment="">
5   - <change beforePath="" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/java/activity/Accesslog.java" />
6   - <change beforePath="" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/java/adapters/ListAdapterAccesslog.java" />
7   - <change beforePath="" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/java/dataclasses/Accesslog.java" />
8   - <change beforePath="" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/res/layout/accessloglist.xml" />
9   - <change beforePath="$PROJECT_DIR$/../Risiko/app/src/main/AndroidManifest.xml" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/AndroidManifest.xml" />
10   - <change beforePath="$PROJECT_DIR$/../Risiko/app/src/main/java/activity/Incident.java" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/java/activity/Incident.java" />
11   - <change beforePath="$PROJECT_DIR$/../Risiko/app/src/main/java/activity/Log.java" afterPath="" />
12   - <change beforePath="$PROJECT_DIR$/../Risiko/app/src/main/java/api/Endpoints.java" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/java/api/Endpoints.java" />
13   - <change beforePath="$PROJECT_DIR$/../Risiko/app/src/main/res/layout/activity_log.xml" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/res/layout/activity_log.xml" />
14   - <change beforePath="$PROJECT_DIR$/../Risiko/app/src/main/res/values/strings.xml" afterPath="$PROJECT_DIR$/../Risiko/app/src/main/res/values/strings.xml" />
15   - <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
16   - <change beforePath="$PROJECT_DIR$/api/routes/routes.js" afterPath="$PROJECT_DIR$/api/routes/routes.js" />
17   - </list>
  4 + <list default="true" id="0e20d303-9de8-4113-bfd9-019e72b304dc" name="Default" comment="" />
18 5 <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
19 6 <option name="TRACKING_ENABLED" value="true" />
20 7 <option name="SHOW_DIALOG" value="false" />
... ... @@ -61,7 +48,7 @@
61 48 <file leaf-file-name="routes.js" pinned="false" current-in-tab="true">
62 49 <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
63 50 <provider selected="true" editor-type-id="text-editor">
64   - <state relative-caret-position="-179">
  51 + <state relative-caret-position="-424">
65 52 <caret line="415" column="13" lean-forward="true" selection-start-line="415" selection-start-column="13" selection-end-line="415" selection-end-column="52" />
66 53 <folding />
67 54 </state>
... ... @@ -267,7 +254,7 @@
267 254 <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
268 255 <window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
269 256 <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="true" content_ui="tabs" />
270   - <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32769045" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
  257 + <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32769045" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
271 258 <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
272 259 <window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1389728" sideWeight="0.30755395" order="2" side_tool="true" content_ui="tabs" />
273 260 <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
... ... @@ -376,7 +363,7 @@
376 363 </entry>
377 364 <entry file="file://$PROJECT_DIR$/api/routes/routes.js">
378 365 <provider selected="true" editor-type-id="text-editor">
379   - <state relative-caret-position="-179">
  366 + <state relative-caret-position="-424">
380 367 <caret line="415" column="13" lean-forward="true" selection-start-line="415" selection-start-column="13" selection-end-line="415" selection-end-column="52" />
381 368 <folding />
382 369 </state>
... ...