Skip to content

Commit

Permalink
Qubicle pro quantifiers master (2600hz#6362)
Browse files Browse the repository at this point in the history
* KQUB-56: update quantifiers to support pro and basic

* changes based on Karl feedback and discussion

* more pr comment fixes
  • Loading branch information
mark2600 authored Mar 6, 2020
1 parent 1c14a92 commit 1a791e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions core/kazoo_services/src/kazoo_services_maintenance.erl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ js_quantify_map() ->
" case 'user':"
" emit(['users', doc.priv_level], 1);"
" if (doc.qubicle && doc.qubicle.enabled) {"
" emit(['qubicle', 'recipients'], 1);"
" if (doc.qubicle.recipient) {"
" emit(['qubicle', doc.qubicle.recipient.offering || 'basic' + '_recipient'], 1);"
" }"
" }"
" break;"
" case 'device':"
Expand Down Expand Up @@ -211,7 +213,7 @@ js_quantify_map() ->
,kazoo_numbers_maintenance:generate_js_classifiers(FunMatchBlock),
" break;"
" case 'qubicle_queue':"
" emit(['qubicle', 'queues'], 1);"
" emit(['qubicle', doc.pvt_offering || 'basic' + '_queue'], 1);"
" break;"
" case 'vmbox':"
" emit(['voicemails', 'mailbox'], 1);"
Expand Down
6 changes: 4 additions & 2 deletions core/kazoo_services/src/kz_services_quantities.erl
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ calculate_qubicle_queue_updates(JObj, Updates) ->
case kz_doc:type(JObj) =:= <<"qubicle_queue">> of
'false' -> Updates;
'true' ->
Key = [<<"qubicle">>, <<"queues">>],
Offering = kz_json:get_ne_value(<<"pvt_offering">>, JObj, <<"basic">>),
Key = [<<"qubicle">>, <<Offering/binary, "_queue">>],
[{Key, 1} | Updates]
end.

Expand All @@ -547,7 +548,8 @@ calculate_qubicle_recipient_updates(JObj, Updates) ->
of
'false' -> Updates;
'true' ->
Key = [<<"qubicle">>, <<"recipients">>],
Offering = kz_json:get_ne_value([<<"qubicle">>, <<"recipient">>, <<"offering">>], JObj, <<"basic">>),
Key = [<<"qubicle">>, <<Offering/binary, "_recipient">>],
[{Key, 1} | Updates]
end.

Expand Down
6 changes: 4 additions & 2 deletions core/kazoo_services/src/services.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@
]
}
,{<<"qubicle">>
,[<<"queues">>
,<<"recipients">>
,[<<"basic_queue">>
,<<"pro_queue">>
,<<"basic_recipient">>
,<<"pro_recipient">>
]
}
,{<<"voicemails">>
Expand Down

0 comments on commit 1a791e8

Please sign in to comment.