carolmanderson commited on
Commit
d9218bf
2 Parent(s): 015197e 9cb3d0b

Merge remote-tracking branch 'upstream/main' into docker-hf

Browse files
indie_label_svelte/src/HypothesisPanel.svelte CHANGED
@@ -95,7 +95,7 @@
95
  selected = all_reports[0];
96
  setActive(selected);
97
  cur_open_evidence = selected["evidence"];
98
- unfinished_count = all_reports.filter(item => !item.complete_status).length
99
  has_complete_report = hasCompleteReport();
100
  return all_reports;
101
  }
@@ -165,15 +165,13 @@
165
  evidence: [],
166
  text_entry: "",
167
  sep_selection: "",
168
- complete_status: false,
169
  };
170
  all_reports = all_reports.concat(new_report);
171
  promise = Promise.resolve(all_reports);
172
  // Open this new report
173
  selected = all_reports[all_reports.length - 1];
174
  cur_open_evidence = selected["evidence"];
175
- selected["complete_status"] = false;
176
- unfinished_count = all_reports.filter(item => !item.complete_status).length
177
  }
178
 
179
  function handleDeleteReport() {
@@ -182,17 +180,11 @@
182
  promise = Promise.resolve(all_reports);
183
  selected = all_reports[0];
184
  cur_open_evidence = selected["evidence"];
185
- unfinished_count = all_reports.filter(item => !item.complete_status).length
186
- }
187
-
188
- function handleMarkComplete() {
189
- selected["complete_status"] = !selected["complete_status"];
190
- unfinished_count = all_reports.filter(item => !item.complete_status).length
191
- handleSaveReport(); // Auto-save report
192
  }
193
 
194
  function hasCompleteReport() {
195
- return all_reports.some(item => item.complete_status && (item.evidence.length > 0) && (item.text_entry != "") && (item.sep_selection));
196
  }
197
 
198
  // Error type
@@ -309,7 +301,7 @@
309
  on:click={() => setActive(report)}
310
  activated={selected === report}
311
  >
312
- {#if report["complete_status"]}
313
  <Graphic class="material-icons" aria-hidden="true">task_alt</Graphic>
314
  {:else}
315
  <Graphic class="material-icons" aria-hidden="true">radio_button_unchecked</Graphic>
@@ -455,7 +447,7 @@
455
 
456
  </div>
457
 
458
- <div class="spacing_vert_40">
459
  <div class="head_6">
460
  <b>Audit Category</b>
461
  </div>
@@ -467,18 +459,6 @@
467
  </Select>
468
  </div>
469
  </div>
470
-
471
- <div class="spacing_vert_100_bottom">
472
- <div>
473
- <span class="head_6"><b>Mark report as complete?</b></span>
474
- <FormField>
475
- <Checkbox checked={selected["complete_status"]} on:change={handleMarkComplete} />
476
- </FormField>
477
- <br>
478
- <p>Reports must be marked as complete and include all fields before they can be sent to AVID below.</p>
479
- </div>
480
-
481
- </div>
482
  </div>
483
  {/if}
484
  </main>
@@ -540,9 +520,8 @@
540
  on:click={handleSubmitReport}
541
  variant="outlined"
542
  color="secondary"
543
- disabled={!has_complete_report}
544
  >
545
- <Label>Send to AVID</Label>
546
  </Button>
547
  {/key}
548
 
 
95
  selected = all_reports[0];
96
  setActive(selected);
97
  cur_open_evidence = selected["evidence"];
98
+ unfinished_count = all_reports.filter(item => (item.evidence.length == 0) || (item.text_entry == "") || !(item.sep_selection)).length
99
  has_complete_report = hasCompleteReport();
100
  return all_reports;
101
  }
 
165
  evidence: [],
166
  text_entry: "",
167
  sep_selection: "",
 
168
  };
169
  all_reports = all_reports.concat(new_report);
170
  promise = Promise.resolve(all_reports);
171
  // Open this new report
172
  selected = all_reports[all_reports.length - 1];
173
  cur_open_evidence = selected["evidence"];
174
+ unfinished_count = all_reports.filter(item => (item.evidence.length == 0) || (item.text_entry == "") || !(item.sep_selection)).length
 
175
  }
176
 
177
  function handleDeleteReport() {
 
180
  promise = Promise.resolve(all_reports);
181
  selected = all_reports[0];
182
  cur_open_evidence = selected["evidence"];
183
+ unfinished_count = all_reports.filter(item => (item.evidence.length == 0) || (item.text_entry == "") || !(item.sep_selection)).length
 
 
 
 
 
 
184
  }
185
 
186
  function hasCompleteReport() {
187
+ return all_reports.some(item => (item.evidence.length > 0) && (item.text_entry != "") && (item.sep_selection));
188
  }
189
 
190
  // Error type
 
301
  on:click={() => setActive(report)}
302
  activated={selected === report}
303
  >
304
+ {#if (report["evidence"].length > 0) && (report["text_entry"] != "") && (report["sep_selection"])}
305
  <Graphic class="material-icons" aria-hidden="true">task_alt</Graphic>
306
  {:else}
307
  <Graphic class="material-icons" aria-hidden="true">radio_button_unchecked</Graphic>
 
447
 
448
  </div>
449
 
450
+ <div class="spacing_vert_40 spacing_vert_100_bottom">
451
  <div class="head_6">
452
  <b>Audit Category</b>
453
  </div>
 
459
  </Select>
460
  </div>
461
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
462
  </div>
463
  {/if}
464
  </main>
 
520
  on:click={handleSubmitReport}
521
  variant="outlined"
522
  color="secondary"
 
523
  >
524
+ <Label>Send Reports to AVID</Label>
525
  </Button>
526
  {/key}
527
 
indie_label_svelte/src/SubmitReportDialog.svelte CHANGED
@@ -3,12 +3,19 @@
3
  import Button, { Label } from "@smui/button";
4
  import Textfield from "@smui/textfield";
5
  import CircularProgress from '@smui/circular-progress';
 
6
 
7
  export let open;
8
  export let cur_user;
9
  export let all_reports;
10
  let name = "";
11
  let email = "";
 
 
 
 
 
 
12
 
13
  let promise_submit = Promise.resolve(null);
14
  function handleSubmitReport() {
@@ -16,9 +23,17 @@
16
  }
17
 
18
  async function submitReport() {
 
 
 
 
 
 
 
 
19
  let req_params = {
20
  cur_user: cur_user,
21
- reports: JSON.stringify(all_reports),
22
  name: name,
23
  email: email,
24
  };
@@ -49,11 +64,15 @@
49
 
50
  <!-- Summary of complete reports -->
51
  <div>
52
- <p><b>Summary of Reports to Send</b> (Reports that include all fields and are marked as complete)</p>
 
53
  <ul>
54
- {#each all_reports as report}
55
- {#if report["complete_status"] && (report["evidence"].length > 0) && (report["text_entry"] != "") && (report["sep_selection"])}
56
- <li>{report["title"]}</li>
 
 
 
57
  <ul>
58
  <li>Error Type: {report["error_type"]}</li>
59
  <li>Evidence: Includes {report["evidence"].length} example{(report["evidence"].length > 1) ? 's' : ''}</li>
@@ -75,7 +94,7 @@
75
 
76
  <!-- Submission and status message -->
77
  <div class="dialog_footer">
78
- <Button on:click={handleSubmitReport} variant="outlined">
79
  <Label>Submit Report to AVID</Label>
80
  </Button>
81
 
 
3
  import Button, { Label } from "@smui/button";
4
  import Textfield from "@smui/textfield";
5
  import CircularProgress from '@smui/circular-progress';
6
+ import Checkbox from '@smui/checkbox';
7
 
8
  export let open;
9
  export let cur_user;
10
  export let all_reports;
11
  let name = "";
12
  let email = "";
13
+ // which_reports_to_submit is an array of booleans that tracks whether the report
14
+ // in the corresponding index of all_reports should be submitted to AVID.
15
+ let which_reports_to_submit = [];
16
+ for (let i = 0; i < all_reports.length; i++) {
17
+ which_reports_to_submit.push(false);
18
+ }
19
 
20
  let promise_submit = Promise.resolve(null);
21
  function handleSubmitReport() {
 
23
  }
24
 
25
  async function submitReport() {
26
+ //Get the relevant reports
27
+ let submitted_reports = [];
28
+ for (let i = 0; i < which_reports_to_submit.length; i++) {
29
+ if (which_reports_to_submit[i]) {
30
+ submitted_reports.push(all_reports[i])
31
+ }
32
+ }
33
+
34
  let req_params = {
35
  cur_user: cur_user,
36
+ reports: JSON.stringify(submitted_reports),
37
  name: name,
38
  email: email,
39
  };
 
64
 
65
  <!-- Summary of complete reports -->
66
  <div>
67
+ <p><b>Summary of Reports Eligible to Send</b> (Reports that include all fields)</p>
68
+ <p> Select the reports you want to submit. </p>
69
  <ul>
70
+ {#each all_reports as report, index}
71
+ {#if (report["evidence"].length > 0) && (report["text_entry"] != "") && (report["sep_selection"])}
72
+
73
+ <input type="checkbox" bind:checked={which_reports_to_submit[index]} />
74
+
75
+ <span>{report["title"]}</span>
76
  <ul>
77
  <li>Error Type: {report["error_type"]}</li>
78
  <li>Evidence: Includes {report["evidence"].length} example{(report["evidence"].length > 1) ? 's' : ''}</li>
 
94
 
95
  <!-- Submission and status message -->
96
  <div class="dialog_footer">
97
+ <Button on:click={handleSubmitReport} variant="outlined" disabled={which_reports_to_submit.filter(item => item).length == 0}>
98
  <Label>Submit Report to AVID</Label>
99
  </Button>
100