Christina-A-Pan commited on
Commit
e7655e6
1 Parent(s): 9a85cb5

Added the ability to select which reports should be submitted to AVID. Also removed the completed checkbox in the Hypothesis panel along with accompanying data.

Browse files
indie_label_svelte/src/HypothesisPanel.svelte CHANGED
@@ -92,7 +92,7 @@
92
  selected = all_reports[0];
93
  setActive(selected);
94
  cur_open_evidence = selected["evidence"];
95
- unfinished_count = all_reports.filter(item => !item.complete_status).length
96
  has_complete_report = hasCompleteReport();
97
  return all_reports;
98
  }
@@ -158,15 +158,13 @@
158
  evidence: [],
159
  text_entry: "",
160
  sep_selection: "",
161
- complete_status: false,
162
  };
163
  all_reports = all_reports.concat(new_report);
164
  promise = Promise.resolve(all_reports);
165
  // Open this new report
166
  selected = all_reports[all_reports.length - 1];
167
  cur_open_evidence = selected["evidence"];
168
- selected["complete_status"] = false;
169
- unfinished_count = all_reports.filter(item => !item.complete_status).length
170
  }
171
 
172
  function handleDeleteReport() {
@@ -175,17 +173,11 @@
175
  promise = Promise.resolve(all_reports);
176
  selected = all_reports[0];
177
  cur_open_evidence = selected["evidence"];
178
- unfinished_count = all_reports.filter(item => !item.complete_status).length
179
- }
180
-
181
- function handleMarkComplete() {
182
- selected["complete_status"] = !selected["complete_status"];
183
- unfinished_count = all_reports.filter(item => !item.complete_status).length
184
- handleSaveReport(); // Auto-save report
185
  }
186
 
187
  function hasCompleteReport() {
188
- return all_reports.some(item => item.complete_status && (item.evidence.length > 0) && (item.text_entry != "") && (item.sep_selection));
189
  }
190
 
191
  // Error type
@@ -302,7 +294,7 @@
302
  on:click={() => setActive(report)}
303
  activated={selected === report}
304
  >
305
- {#if report["complete_status"]}
306
  <Graphic class="material-icons" aria-hidden="true">task_alt</Graphic>
307
  {:else}
308
  <Graphic class="material-icons" aria-hidden="true">radio_button_unchecked</Graphic>
@@ -460,18 +452,6 @@
460
  </Select>
461
  </div>
462
  </div>
463
-
464
- <div class="spacing_vert_100_bottom">
465
- <div>
466
- <span class="head_6"><b>Mark report as complete?</b></span>
467
- <FormField>
468
- <Checkbox checked={selected["complete_status"]} on:change={handleMarkComplete} />
469
- </FormField>
470
- <br>
471
- <p>Reports must be marked as complete and include all fields before they can be sent to AVID below.</p>
472
- </div>
473
-
474
- </div>
475
  </div>
476
  {/if}
477
  </main>
@@ -516,9 +496,8 @@
516
  on:click={handleSubmitReport}
517
  variant="outlined"
518
  color="secondary"
519
- disabled={!has_complete_report}
520
  >
521
- <Label>Send to AVID</Label>
522
  </Button>
523
  {/key}
524
 
 
92
  selected = all_reports[0];
93
  setActive(selected);
94
  cur_open_evidence = selected["evidence"];
95
+ unfinished_count = all_reports.filter(item => (item.evidence.length == 0) || (item.text_entry == "") || !(item.sep_selection)).length
96
  has_complete_report = hasCompleteReport();
97
  return all_reports;
98
  }
 
158
  evidence: [],
159
  text_entry: "",
160
  sep_selection: "",
 
161
  };
162
  all_reports = all_reports.concat(new_report);
163
  promise = Promise.resolve(all_reports);
164
  // Open this new report
165
  selected = all_reports[all_reports.length - 1];
166
  cur_open_evidence = selected["evidence"];
167
+ unfinished_count = all_reports.filter(item => (item.evidence.length == 0) || (item.text_entry == "") || !(item.sep_selection)).length
 
168
  }
169
 
170
  function handleDeleteReport() {
 
173
  promise = Promise.resolve(all_reports);
174
  selected = all_reports[0];
175
  cur_open_evidence = selected["evidence"];
176
+ unfinished_count = all_reports.filter(item => (item.evidence.length == 0) || (item.text_entry == "") || !(item.sep_selection)).length
 
 
 
 
 
 
177
  }
178
 
179
  function hasCompleteReport() {
180
+ return all_reports.some(item => (item.evidence.length > 0) && (item.text_entry != "") && (item.sep_selection));
181
  }
182
 
183
  // Error type
 
294
  on:click={() => setActive(report)}
295
  activated={selected === report}
296
  >
297
+ {#if (report["evidence"].length > 0) && (report["text_entry"] != "") && (report["sep_selection"])}
298
  <Graphic class="material-icons" aria-hidden="true">task_alt</Graphic>
299
  {:else}
300
  <Graphic class="material-icons" aria-hidden="true">radio_button_unchecked</Graphic>
 
452
  </Select>
453
  </div>
454
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
455
  </div>
456
  {/if}
457
  </main>
 
496
  on:click={handleSubmitReport}
497
  variant="outlined"
498
  color="secondary"
 
499
  >
500
+ <Label>Send Reports to AVID</Label>
501
  </Button>
502
  {/key}
503
 
indie_label_svelte/src/SubmitReportDialog.svelte CHANGED
@@ -3,12 +3,17 @@
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 +21,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 +62,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 +92,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
+ let which_reports_to_submit = [];
14
+ for (let i = 0; i < all_reports.length; i++) {
15
+ which_reports_to_submit.push(false);
16
+ }
17
 
18
  let promise_submit = Promise.resolve(null);
19
  function handleSubmitReport() {
 
21
  }
22
 
23
  async function submitReport() {
24
+ //Get the relevant reports
25
+ let submitted_reports = [];
26
+ for (let i = 0; i < which_reports_to_submit.length; i++) {
27
+ if (which_reports_to_submit[i]) {
28
+ submitted_reports.push(all_reports[i])
29
+ }
30
+ }
31
+
32
  let req_params = {
33
  cur_user: cur_user,
34
+ reports: JSON.stringify(submitted_reports),
35
  name: name,
36
  email: email,
37
  };
 
62
 
63
  <!-- Summary of complete reports -->
64
  <div>
65
+ <p><b>Summary of Reports Eligible to Send</b> (Reports that include all fields)</p>
66
+ <p> Select the reports you want to submit. </p>
67
  <ul>
68
+ {#each all_reports as report, index}
69
+ {#if (report["evidence"].length > 0) && (report["text_entry"] != "") && (report["sep_selection"])}
70
+
71
+ <input type="checkbox" bind:checked={which_reports_to_submit[index]} />
72
+
73
+ <span>{report["title"]}</span>
74
  <ul>
75
  <li>Error Type: {report["error_type"]}</li>
76
  <li>Evidence: Includes {report["evidence"].length} example{(report["evidence"].length > 1) ? 's' : ''}</li>
 
92
 
93
  <!-- Submission and status message -->
94
  <div class="dialog_footer">
95
+ <Button on:click={handleSubmitReport} variant="outlined" disabled={which_reports_to_submit.filter(item => item).length == 0}>
96
  <Label>Submit Report to AVID</Label>
97
  </Button>
98