MCPcopy Create free account
hub / github.com/codecombat/codecombat / constructor

Method constructor

app/views/admin/TrialRequestsView.js:29–54  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

27 }
28
29 constructor (options) {
30 super(options)
31 if (me.isAdmin()) {
32 const sortRequests = function (a, b) {
33 const statusA = a.get('status')
34 const statusB = b.get('status')
35 if ((statusA === 'submitted') && (statusB === 'submitted')) {
36 if (a.get('created') < b.get('created')) {
37 return -1
38 } else {
39 return 1
40 }
41 } else if (statusA === 'submitted') {
42 return -1
43 } else if (statusB === 'submitted') {
44 return 1
45 } else if (!b.get('reviewDate') || (a.get('reviewDate') > b.get('reviewDate'))) {
46 return -1
47 } else {
48 return 1
49 }
50 }
51 this.trialRequests = new CocoCollection([], { url: '/db/trial.request?conditions[sort]="-created"&conditions[limit]=1000', model: TrialRequest, comparator: sortRequests })
52 this.supermodel.loadCollection(this.trialRequests, 'trial-requests', { cache: false })
53 }
54 }
55
56 getRenderData () {
57 const context = super.getRenderData()

Callers

nothing calls this directly

Calls 1

isAdminMethod · 0.80

Tested by

no test coverage detected