-
-
Save ijunaid8989/8dadd98ca7dfb7659c7d1ae7376a0a35 to your computer and use it in GitHub Desktop.
data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[%EdgeCommander.ThreeScraper.SimLogs{__meta__: #Ecto.Schema.Metadata<:loaded, "sim_logs">, | |
addon: "60GB Broadband", allowance: "61,440.00 MB", | |
datetime: ~N[2017-09-28 05:50:04.783484], id: 607, name: "User 5 Sim", | |
number: "0864667951", volume_used: "18,977.80 MB"}, | |
%EdgeCommander.ThreeScraper.SimLogs{__meta__: #Ecto.Schema.Metadata<:loaded, "sim_logs">, | |
addon: "60GB Broadband", allowance: "61,440.00 MB", | |
datetime: ~N[2017-10-10 17:09:19.712257], id: 645, name: "User 5 Sim", | |
number: "0864667951", volume_used: "45,746.76 MB"}, | |
%EdgeCommander.ThreeScraper.SimLogs{__meta__: #Ecto.Schema.Metadata<:loaded, "sim_logs">, | |
addon: "60GB Broadband", allowance: "61,440.00 MB", | |
datetime: ~N[2017-10-11 12:49:17.312840], id: 685, name: "User 5 Sim", | |
number: "0864667951", volume_used: "46,003.94 MB"}, | |
%EdgeCommander.ThreeScraper.SimLogs{__meta__: #Ecto.Schema.Metadata<:loaded, "sim_logs">, | |
addon: "60GB Broadband", allowance: "61,440.00 MB", | |
datetime: ~N[2017-10-12 11:00:30.864933], id: 805, name: "VPN6 SSJV3B", | |
number: "0864667951", volume_used: "50,445.82 MB"}, | |
%EdgeCommander.ThreeScraper.SimLogs{__meta__: #Ecto.Schema.Metadata<:loaded, "sim_logs">, | |
addon: "60GB Broadband", allowance: "61,440.00 MB", | |
datetime: ~N[2017-10-13 05:28:47.164846], id: 827, name: "VPN6 SSJV3B", | |
number: "0864667951", volume_used: "52,482.37 MB"}, | |
%EdgeCommander.ThreeScraper.SimLogs{__meta__: #Ecto.Schema.Metadata<:loaded, "sim_logs">, | |
addon: "60GB Broadband", allowance: "61,440.00 MB", | |
datetime: ~N[2017-10-16 12:26:58.843329], id: 871, name: "VPN6 SSJV3B", | |
number: "0864667951", volume_used: "57,192.28 MB"}, | |
%EdgeCommander.ThreeScraper.SimLogs{__meta__: #Ecto.Schema.Metadata<:loaded, "sim_logs">, | |
addon: "60GB Broadband", allowance: "61,440.00 MB", | |
datetime: ~N[2017-10-17 09:44:49.616508], id: 981, name: "VPN6 SSJV3B", | |
number: "0864667951", volume_used: "57,193.03 MB"}] | |
var days_left = (t.allowance_in_number - t.current_in_number) / (t.current_in_number - t.yesterday_in_number) | |
return Math.round(days_left * 100) / 100; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from the above data,
we actually going to pick last 2 entries, which are
and then
allowance in number is going to be the same for both:
allowance: "61,440.00 MB"
in number (61440
)..and
current in number is meant to be, the very last record's volume used, in above case it's, 57193.03
and
yesterday in number is ...
57192.28
..what we need to count, now as we have today's usage and yesterdays usage, and total allowance as well. we want to know how many days left, for the allowance. like its being used in this ratio and now it will take such days to get to full?
I hope you understand the question?
above I have stated how I am getting the days left at the moment.