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

RoundingWell / care-ops-frontend / d35cdd0e-4627-4540-a585-fe4f753c38ef

27 Mar 2026 04:25PM UTC coverage: 22.923% (-77.0%) from 99.94%
d35cdd0e-4627-4540-a585-fe4f753c38ef

push

circleci

paulfalgout
Trigger app-tests after qa2 deploys

75 of 625 branches covered (12.0%)

Branch coverage included in aggregate %.

496 of 1866 relevant lines covered (26.58%)

15.84 hits per line

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

0.0
/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
    'fetch': 'fetchWorkspace',
12
  },
13
  _getWorkspace(slug) {
14
    const currentUser = Radio.request('bootstrap', 'currentUser');
×
15
    const workspaces = currentUser.getWorkspaces();
×
16

17
    if (!workspaces.length) throw 'No workspaces found';
×
18

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

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

32
    return workspace;
×
33
  },
34
  getCurrentWorkspace(route) {
35
    if (route) {
×
36
      return this._setCurrentWorkspace(route);
×
37
    }
38

39
    return this.currentWorkspace;
×
40
  },
41
  _getSharedWorkspaces(programs) {
42
    const sharedWorkspaces = Radio.request('entities', 'workspaces:collection');
×
43

44
    programs.each(program => {
×
45
      const workspaces = program.getUserWorkspaces();
×
46

47
      sharedWorkspaces.add(workspaces.models);
×
48
    });
49

50
    return sharedWorkspaces;
×
51
  },
52
  initialize({ route }) {
53
    this._setCurrentWorkspace(route);
×
54
  },
55
  beforeStart() {
56
    return [
×
57
      Radio.request('entities', 'fetch:programs:byWorkspace', this.currentWorkspace.id),
58
      Radio.request('entities', 'fetch:states:collection'),
59
      Radio.request('entities', 'fetch:forms:collection'),
60
    ];
61
  },
62
  onStart(options, programs) {
63
    const workspaces = this._getSharedWorkspaces(programs);
×
64

65
    const clinicianRequests = workspaces.map(workspace => {
×
66
      return Radio.request('entities', 'fetch:clinicians:byWorkspace', workspace.id);
×
67
    });
68

69
    Promise.all([...clinicianRequests])
×
70
      .then(() => {
71
        this.resolvePromise(this.currentWorkspace);
×
72
      })
73
      .catch((...args) => {
74
        this.rejectPromise(...args);
×
75
        this.stop();
×
76
      });
77
  },
78
  onFail(options, ...args) {
79
    this.rejectPromise(...args);
×
80
  },
81
  fetchWorkspace() {
82
    const promise = new Promise((resolvePromise, rejectPromise) => {
×
83
      this.resolvePromise = resolvePromise;
×
84
      this.rejectPromise = rejectPromise;
×
85
    });
86

87
    if (this.isRunning()) {
×
88
      this.restart();
×
89

90
      return promise;
×
91
    }
92

93
    this.start();
×
94

95
    return promise;
×
96
  },
97
});
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