Gerrit: All activity for a user in a given time period - gerrit

I would like to get ALL activity for a given user in a time period. That is, all revisions they have done on patches they own or on patches others own, all comments and all reviews. 1) Are there other activities in Gerrit that I am missing? 2) Will the following query do what I want?
(owner:'USER' OR commentby:'USER' OR reviewedby:'USER' OR author:'AUTHOR' OR committer:'COMMITTER') and (before:end-date after:begin-date)
Thanks

Your search is ok and I think there aren't any search clauses to be added.
Just some comments below:
1) You can replace "owner:USER OR commentby:USER" to just "from:USER"
2) You can replace "USER" to "me" to get info from your own user
See more info at Gerrit documentation here

Related

JQL query to retrieve issues where I participated

I try to list all issues where I was a participant. On top of issues asssigned to me, I want to include issues that followed the normal procedure: somebody else created them, they were assigned to me, I solved them, and re-assigned to somebody else for testing.
So far, I tried participant=currentUser(), but it return only issues where I am a reporter or assignee.
If I look in a specific Jira issue, it shows as participants: userA, myUser, userC. But the query above includes this issue only for userA (reporter) or userC (assignee).
How can I write a JQL query to retrieve all issues where my iser was a particilant?
So far, the best solution I found was:
assignee was currentUser() or assignee = currentUser()
Try this query
text ~ currentuser()
This query will fetch you all the issues which your user is mentioned, participated in, assigned and etc.

Filter issues updated by particular user in period of time using JQL

Is there any way to find all issues updated by particular user in particular time period in every day by using JQL or is there any plugin to solve this?.
If by updated you mean change of status you can chack something like this:
status changed by "user.name" and updated > startOfDay("-1")
Of course the start of the day -1 shows everything updated since yesterday, but you can also go with hours.
You could run a query like this:
reporter = usernameGoesHere AND created > startOfDay() and created < "2015/06/18 15:00"
So I had one ticket that I created at 2:20. Running this query gave me all issues created from the start of today and then queried out the results that were created before 6/18 at 3:00PM
Let me know if this helps you out.
You can also look at the Advanced Filtering page for JIRA
assignee = 'your user' AND updated > startOfDay()
You can create a filter which will update daily.

Pull reports from Shopify

I am trying to pull reports automatically from shopify admin portal. From source page I can see that javascript function makes this call -
var shopifyQL = "**SHOW** quantity_count, total_sales BY product_type, product_title, sku, shipping_city, traffic_source, source, variant_title, host, shipping_country, shipping_province, day, month, referrer FROM **products** SINCE xxx UNTIL yyy ORDER BY total_sales DESC";
var options = {"category":"product_reports","id":wwwwww,"name":"Product Report by SKU","shopify_ql":"SHOW quantity_count, total_sales BY product_type, product_title, sku, shipping_city, traffic_source, source, variant_title, host, shipping_country, shipping_province, day, month, referrer FROM products SINCE xxxx UNTIL yyyy ORDER BY total_sales DESC","updated_at":"zzz"};
However looking at the product API (https://docs.shopify.com/api/product) I do not see most of the attributes. I am assuming some join tables or seperate calls to the model. Also I tried to pull single sku information but it pulls everything.
ShopifyAPI::Product.find(:all, :params => {:variants => {:sku => 'zzzz'}})
Does anybody had any experience to work with reports??
You need to grab the data from the api and play with it. The available objects are clearly stated on the Shopify API docs. Admin dashboard data can't be pulled like the way you seem to envision unless you play with JavaScript injection (tampermonkey...) which is highly not recommended.
It would go like this for you. First off, if you pull products, you have do so in chunks of 250. The :all symbol gives you up to 250. Supplying a page and limit parameter would help there.
Second, you cannot filter by SKU. Instead, download all the products, and then inside each product are the variants. A variant has a SKU, so you'd search that way.
Doing that, you could setup your own nice reference data structure, ready to be used in reporting as you see fit.

Rails update database field according to two other fields

So I have 2 fields in my Articles table.
- :vote_up
- :vote_down
I have methods in my app of updating the :vote_up and :vote_down fields that work fine. What I want to do is order my articles by total votes (:vote_up minus :vote_down).
What is the best way to do this. Can I do this directly in the controller with a certain method? Or must I create a :vote_total field that updates automatically according to the values of the other two fields (if so how do you do this).
Many thanks!
Don't do this in your controller. This is meant to be done in your model. Controllers should just use the model.
You can do this in 2 ways:
Solution 1
Try this in your console (rails c)
Article
.unscoped
.select(%q(articles.*, (articles.vote_up - articles.vote_down) AS vote_total))
.order(%q(vote_total DESC))
and the implement it as a scope in your Article class
scope :order_by_total_votes, -> {
select(%q(articles.*, (articles.vote_up - articles.vote_down) AS vote_total))
.order(%q(vote_total DESC))
}
Solution 2
Create a field vote_total for your Article and update it every time one of the vote fields gets updated (use a before_save callback). Then you can do the same as in solution 1, but without the select part.
Suggestion
I would go with solution 2, because amongst others it is faster in queries
Hope this helps.
Thanks #Hiasinho for your direction. I ended up just creating a :vote_total to my Article database and updated it on both my upvote and downvote methods like so
#article.update_attributes(vote_total: #article.vote_total + 1)
Obviously it was a -1 for downvotes.

Want to count number of visits on my blogs

I want to count the number of visits on my blog? Can someone please suggest the overall method to implement this feature?
It is just an idea. You can add a count_view column in the database into blogs table with default value 0.
And in the show action of BlogsController add the following code
def show
#blog = Blog.where('id = ?', params[:id]).first
#blog.update_column('count_view', #blog.count_view + 1) if #blog.present?
end
You can modify this logic as per your requirement.
You can check the hit counter gem or the impressionist gem.
You could also use an existing (free) analytics solutions if you want to get much more data than the number of times the action was called (please note that if the same user refreshes the browser 5 times, you get 5 hits):
http://www.google.com/analytics/
Using these you can get data like unique visitors, referral URL, locations data, browser, OS, and a lot of different stuff to make informed decisions. There are several other options (paid, free, real time) available as well:
https://mixpanel.com
https://www.kissmetrics.com/

Resources