Definition without GetAwaiter (Razor, MVC) [duplicate]

This question already has an answer here: ASP.NET Identity 2 UserManager get all users async 2 answers I got below class: public class AllRegistrationsViewComponent : ViewComponent { private readonly UserManager<IdentityUser> um; private readonly MyContext myContext; public AllRegistrationsViewComponent(UserManager<IdentityUser> um, MyContext myContext) { this.um = um; this.myContext= myContext; } public async Task<IViewComponentResult> Invoke() { var allUsers= await…

Details

How to optimize annotate in django query?

This code is taking 55 seconds to run, is there any way to optimize this? It is unfeasible start_time2 = tm.time() _candidates_ext = _candidates.annotate(month=TruncMonth(‘apply_date’)).values(‘month’).annotate(jcount=Count(‘pk’)).order_by(‘month’) context[‘candidates_total’] = len(_candidates) #context[‘candidates_total’] = _candidates.count() context[‘candidates_ext’] = _candidates_ext print(“— %s seconds —” % (tm.time() – start_time2)) print(“===== Connections =====”) print(len(connection.queries)) import pdb; pdb.set_trace() I’m new to the company and would…

Details

Ajax Call: Problem with filter in Article & Articles Model in Module Context

I currently have a problem with an ajax call in my new module. the filters are not used. Here is an extract of the relevant lines: $articleid = $data_decoded->articleid; // Get an instance of the generic articles model require_once(JPATH_ADMINISTRATOR . ‘/components/com_content/models/articles.php’); $model = JModelLegacy::getInstance(‘Articles’, ‘ContentModel’, array(‘ignore_request’ => true)); $model->setState(‘filter.article_id’, $articleid); return $model->getItems(); $articleid contains the…

Details