Emrah Yıldırım
Joined
Activity
Posted in Chart Size Convert
You did the best you could for me... I don't have to use Chartkick. Can you recommend another library or method other than Chartkick? Frankly, you've wasted enough time for me.
I'm using the Chartjs library
Posted in Chart Size Convert
First of all, the code you gave me worked. Thank you so much for that.
Number_to_human_size is doing the calculation, but does not add MB, GB, TB to the end.
You can see it in the picture below.
https://cdn1.imggmi.com/uploads/2018/12/11/e7693f4727397b2957f9d5e5a33c02d8-full.jpg
Posted in Chart Size Convert
Hey
I've looked at this link before. Actually, there's no mistake. The data from the Download table comes in the form of bytes, and I want to show this data in the form of megabyte, gigabyte and Terebyte.
<% @tasks.each do |task| %>
<tr class="gradeX">
<td><%= Time.at(task.intime).utc.strftime("%H:%M:%S") %></td>
<td><%= number_to_human_size(task.downloads) %></td>
<td><%= number_to_human_size(task.uploads) %></td>
</tr>
<% end %>
I managed to show it using Number_to_human_size on the index page with the code above.
However, when I want to display the same process with Chartkick gem file, the data appears as byte.
What's important is how do I add a method like Number_to_human_size to the following Chatkick code?
<%= line_chart Item.group_by_month(:created_at).sum(:download) %>
Posted in Chart Size Convert
Is there anyone who can help me with this?
Respects
Posted in Chart Size Convert
Hi
I have a table called Download, the data in this table comes in bytes.
I want to prepare a chart with Chartkick. However, with the following code, the data comes in bytes. I want it to come in the form of Mb or Gb.
<%= line_chart Item.group_by_month(:created_at).sum(:download) %>
Can this code be used with something like number_to_human_size?
Posted in How do I convert a SQL query to rails?
Hi,
I'm new to ROR. The query I created below is functioning properly. I'm trying to prepare an interrogation. But I didn't succeed. The query is as follows;
@rad_check.tenant_id = SELECT groupname FROM radgrs INNER JOIN nas WHERE radgrs.tenant_id = nas.tenant_id AND nas.realipaddr = "192.168.22.175"
How do I make a switch case for the following queries in another question? Returns NULL if the query fails.
Thank you for caring.
def realipaddr
request.remote_addr
end
def create
@rad_check = RadCheck.new(rad_check_params)
**@rad_check.tenant_id = Na.find_by(realipaddr: realipaddr, active: :true).tenant_id**
respond_to do |format|
if @rad_check.save
format.html { redirect_to @rad_check, notice: 'Rad check was successfully created.' }
format.json { render :show, status: :created, location: @rad_check }
else
format.html { render :new }
format.json { render json: @rad_check.errors, status: :unprocessable_entity }
end
end
end