• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RoundingWell / care-ops-frontend / 692f9f2e-3aac-4156-9197-4812d5314b95

20 Aug 2025 07:09AM UTC coverage: 92.095% (-7.9%) from 100.0%
692f9f2e-3aac-4156-9197-4812d5314b95

Pull #1488

circleci

paulfalgout
Test patient overline on worklist
Pull Request #1488: Add subgrid to lists

1639 of 1844 branches covered (88.88%)

Branch coverage included in aggregate %.

5771 of 6202 relevant lines covered (93.05%)

195.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.88
/src/js/services/workspace.js
1
import { get } from 'underscore';
2
import Radio from 'backbone.radio';
3
import store from 'store';
4

5
import App from 'js/base/app';
6

7
export default App.extend({
8
  channelName: 'workspace',
9
  radioRequests: {
10
    'current': 'getCurrentWorkspace',
11
    'directories': 'getDirectories',
12
    'fetch': 'fetchWorkspace',
13
  },
14
  _getWorkspace(slug) {
15
    const currentUser = Radio.request('bootstrap', 'currentUser');
318✔
16
    const workspaces = currentUser.getWorkspaces();
318✔
17

18
    if (!workspaces.length) throw 'No workspaces found';
318✔
19

20
    return workspaces.find({ slug })
317✔
21
      || workspaces.find({ id: store.get('currentWorkspace') })
22
      || workspaces.at(0);
23
  },
24
  _setCurrentWorkspace(route) {
25
    const workspace = this._getWorkspace(route);
318✔
26

27
    if (workspace.id !== get(this.currentWorkspace, 'id')) {
317✔
28
      store.set('currentWorkspace', workspace.id);
161✔
29
      this.currentWorkspace = workspace;
161✔
30
      this.getChannel().trigger('change:workspace', workspace);
161✔
31
    }
32

33
    return workspace;
317✔
34
  },
35
  getCurrentWorkspace(route) {
36
    if (route) {
9,039✔
37
      return this._setCurrentWorkspace(route);
159✔
38
    }
39

40
    return this.currentWorkspace;
8,880✔
41
  },
42
  getDirectories() {
43
    return this.directories.clone();
5✔
44
  },
45
  _getSharedWorkspaces(programs) {
46
    const sharedWorkspaces = Radio.request('entities', 'workspaces:collection');
159✔
47

48
    programs.each(program => {
159✔
49
      const workspaces = program.getUserWorkspaces();
317✔
50

51
      sharedWorkspaces.add(workspaces.models);
317✔
52
    });
53

54
    return sharedWorkspaces;
159✔
55
  },
56
  initialize({ route }) {
57
    this._setCurrentWorkspace(route);
159✔
58
  },
59
  beforeStart() {
60
    return [
159✔
61
      Radio.request('entities', 'fetch:directories:filterable'),
62
      Radio.request('entities', 'fetch:programs:byWorkspace', this.currentWorkspace.id),
63
      Radio.request('entities', 'fetch:states:collection'),
64
      Radio.request('entities', 'fetch:forms:collection'),
65
    ];
66
  },
67
  onStart(options, directories, programs) {
68
    this.directories = directories;
159✔
69

70
    const workspaces = this._getSharedWorkspaces(programs);
159✔
71

72
    const clinicianRequests = workspaces.map(workspace => {
159✔
73
      return Radio.request('entities', 'fetch:clinicians:byWorkspace', workspace.id);
317✔
74
    });
75

76
    Promise.all([...clinicianRequests])
159✔
77
      .then(() => {
78
        this.resolvePromise(this.currentWorkspace);
159✔
79
      })
80
      .catch((...args) => {
81
        this.rejectPromise(...args);
×
82
        this.stop();
×
83
      });
84
  },
85
  onFail(options, ...args) {
86
    this.rejectPromise(...args);
×
87
  },
88
  fetchWorkspace() {
89
    const promise = new Promise((resolvePromise, rejectPromise) => {
159✔
90
      this.resolvePromise = resolvePromise;
159✔
91
      this.rejectPromise = rejectPromise;
159✔
92
    });
93

94
    if (this.isRunning()) {
159✔
95
      this.restart();
3✔
96

97
      return promise;
3✔
98
    }
99

100
    this.start();
156✔
101

102
    return promise;
156✔
103
  },
104
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc