Views Table with Aggregation, total values counted per option

I’m setting up a view of event registrations. Each registration will be allocated to 1 of 3 workshops at two different times in the day.

I’m looking to output the total number of allocations per workshop so we can try to balance the delegate numbers.

I’m pretty close, but not quite there.

I’m using the Display Format of Table with aggregation options with “Group and Compress” on the Event ID.

I then apply the group function on two data fields: “Allocated Workshop AM” and “Allocated Workshop PM”.

I can get closest to my desired result using the “Tally members” option, however, the results are wrong.

enter image description here

They are showing much lower numbers than are actually allocated.

enter image description here

Any suggestions on how I could achieve this?

How to disable core JS aggregation and AdvAgg just for admin paths

I help look after a site which uses $ settings['file_public_base_url'] to serve files from a different subdomain on the frontend, but on the backend (admin paths like node/add and node/edit) this causes our JS to be loaded with absolute rather than relative URLs which seems to cause an issue with JS loaded via AJAX not executing correctly. There are no JS errors in my devtools console, but I suspect the cause is that the JS is being loaded from differing subdomains, as turning AdvAgg and core’s JS aggregation off makes the JS files load via relative paths and function as intended.

Without any errors showing in my console or server logs I’m not sure I’m going to be able to get to the bottom of the AJAX issue, so for now a compromise seems to be to turn off aggregation for admin and content editing routes.

What would be the best way to do that? I know I can set $ config['system.performance']['js']['preprocess'] = FALSE; and presumably a similar config key for AdvAgg’s own setting (we have AdvAgg set to optimise/compress JS, so even with system.performance.js.preprocess turned off AdvAgg will still manage the files and use absolute paths to include them. Can config settings be altered on a per route/path basis?

Pandas Groupby Conditional Aggregation

Let’s say you have a dataframe as follows:

data = pd.DataFrame({'Year': [2019]*5+[2020]*5,           'Month': [1,1,2,2,3]*2,           'Hour': [0,1,2,3,4]*2,           'Value': [0.2,0.3,0.2,0.1,0.4,0.3,0.2,0.5,0.1,0.2]}) 

Then, set “low” times to be hours between 1 and 3 (inclusive), and “high” times to be all other hours (in this case, hours 0 and 4). What I would like to do is get the average Value for the “low” and “high” times for each Year and Month.

For loops work, but they’re not ideal. I could also create a dummy variable (for instance, 0s and 1s) to signify the “low” and “high” times in the dataframe to groupby. However, it seems to me that there should be some way to use Pandas groupby([‘Year’, ‘Month’]).agg(…) to achieve the result in an efficient/optimal way. I haven’t had any luck thus far using groupby+agg, mainly because agg() uses only a series (not the remaining dataframe), so one can’t use a conditional within agg based on the Hour to calculate the average Value.

Any help is appreciated 🙂

Sum up views custom text field using aggregation

Would it be possible to set the custom text field value in views? I have a simple calculation in custom text field. It gives me the correct calculation, but when I’m trying to aggregate the views to calculate the total sum from custom text field it returns 0 value.

I’m thinking that custom text field has no value in the first place and it’s only output an HTML. Would it be possible to set custom text field value from the calculated output? Or is there any other way to achieve this without using the hook system?

Please note that I’m also attaching another view into custom text field which returns a total sum from another field.

CSS not updating with aggregation turned off

I’m running into an issue that I’m not sure how to diagnose. I’m working on minor CSS updates on a custom zen theme for a Drupal 7 site. I have the dev site set up on a laptop running ubuntu dev server. I have gone to performance and turned off css and js aggregation and flushed all the caches via Drush. The problem I’m having is that my css changes are being saved to the styles.css file, but they’re not reflected when I refresh the site. Poking around in inspector, the css files have a ?oegwy2 suffix, which suggests that something is still aggregating or modifying the files. I’m not sure what that would be, I didn’t set up sass for the this project, so the sass recompiling isn’t likely what’s going on here.

Search display template for content search web part for task aggregation

In a site collection, I have about 4 task list setup each on separate subsites. So on the root level, I am using a content search web part and through query, I am showing tasks from all of these 4 task lists to show aggregated tasks in the web part. Here is the query i am using: path:”https://.sharepoint.com/sites/” ContentTypeId:0x0108* -RefinableString01:Completed

RefineableString01 is a mapped managed property and its helping me showing non- completed (task status other than completed)tasks. Now the challenge I have is to show this web part as close as possible to an actual task list view which has Task name, due date, status, description as task headers/columns in CSWP and I believe it requires setting up a custom display template which I have not worked on at all.

Can someone help me setting up tabular view of tasks aggregation using custom template. FYI, I have already setup managed properties (mapping respective crawled properties to respective managed property called Refineablstring etc) for description, task status and due date.

Additionally, I would also like to show custom choice column called Investor (site column) in the CSWP along with other basic columns, I am waiting for it to get crawled, once crawled, I will setup a managed property for the same.

Can someone please help me with the cswp display template that I can use, thanks in advance.

Aggregation of data from two Microservices

I have two Microservices A and B.

  • B Microservice has a large set of an entity called User.
  • A Microservice stores the User entity in its own DB if User is configured by an agent. There is no flag available in Microservice B‘s DB to find if the User is configured.

I want to find all the list of all unconfigured user by page (Set(B)-Set(A)).

How should I go about querying if User data is too large in B Microservice?

What is the use of Association, Aggregation and Composition?

I have gone through lots of theories about what is encapsulation and the three techniques of implementing it, which are Association, Aggregation and Composition.

What I found is:

Encapsulation

Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding.

Encapsulation can be described as a protective barrier that prevents the code and data being randomly accessed by other code defined outside the class. Access to the data and code is tightly controlled by an interface.

The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this feature Encapsulation gives maintainability, flexibility and extensibility to our code.

Association

Association is a relationship where all object have their own lifecycle and there is no owner. Let’s take an example of Teacher and Student. Multiple students can associate with a single teacher and a single student can associate with multiple teachers, but there is no ownership between the objects and both have their own lifecycle. Both can create and delete independently.

Aggregation

Aggregation is a specialized form of Association where all objects have their own lifecycle, but there is ownership and a child object cannot belong to another parent object. Let’s take an example of a Department and teacher. A single teacher cannot belong to multiple departments, but if we delete the department the teacher object will not be destroyed. We can think of it as a “has-a” relationship.

Composition

Composition is again a specialized form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object does not have their lifecycle and if parent object deletes all child object will also be deleted. Let’s take again an example of relationship between House and rooms. House can contain multiple rooms but there is no independent life of a room and any room cannot belong to two different houses. If we delete the house, the room will automatically be deleted.

The question is:

Now these all are real world examples. I am looking for some description about how to use these techniques in actual class code. I mean what is the point for using three different techniques for encapsulation, How these techniques could be implemented and How to choose which technique is applicable at time.