Aggregated Streaming service? – Ask Different

Aggregated Streaming service? – Ask Different

9 – How to index only end dates in the aggregated field in the search api?

I have two date range fields on two different content types. I want to index only the end date of both of the date range fields.

I can do it by simply clicking the plus icon on the field and add the end date only.

enter image description here

But this is not possible in the aggregate fields. In the aggregate fields.

I have a union on both date fields. But there isn’t an option to select the end dates only?

Is it possible to index only end dates from both the fields in one field as aggregated field? (

theming – Escaping CSS digits, 0 is removed from CSS aggregated files

The following HTML markup won’t work on a production site.

<div class="iconleft 109">TEXT</div>

This is the code in the custom.css file.

.iconleft.31 09,
.iconleft.31 12,
.iconleft.31 10,
.iconleft.31 11,
.iconleft.31 20 {
  background: #B0CD00;
}

.iconleft.31 09 works on localhost with xampp and no aggregation. On the production site, where Advanced CSS/JS Aggregation is activated, it wont work for 109.

In the aggregated CSS file, I see .iconleft.31 9 as CSS class. It seems that 0 has been removed.

Do you have any hint?

theming – Escaping CSS digits – Drupal removes 0 from css aggregated file

the following css code wont work on production site:

<div class="iconleft 109">TEXT</div>

Thats the code in my custom.css file

.iconleft.31 09,
.iconleft.31 12,
.iconleft.31 10,
.iconleft.31 11,
.iconleft.31 20 {
  background: #B0CD00;
}

.iconleft.31 09 works on localhost with xampp and no aggregation.

On prodction site where Advanced CSS/JS Aggregation is activated it wont work for 109!

In the aggregated css file i see the following class: .iconleft.31 9

It seems that 0 is removed.

Any hints? Thank you!

How to aggregate values from fields in Paragraphs based on value of another field in that same paragraph, and display in an aggregated Views table?

Hopefully my title makes sense…

I am setting up a Drupal 9 website for internal use as a financial reporting engine and a CRM. I am making use of the following modules:

  • Paragraphs
  • Views
  • Viewfield
  • View Fields View
  • Views Aggregator Plus

I have one Paragraph (Entity Reference) unlimited-value field on a paragraph type called “Project”. That field is called “Transactions”. It refers to a paragraph type called “Transaction”.

The “Transaction” paragraph type has the following fields:

  • Transaction Amount (decimal field))
  • Status (term reference field. Values are PAID and UNPAID)
  • Paid On (date field)
  • Year (a taxonomy entity reference field that contains pre-set years (2019, 2020, 2021, etc).

I have a content type called “Company”. It has the following fields:

  • Title
  • Project (a Paragraph/Entity Reference field)
  • Transaction Amount – Paid (a Viewfield)
  • Transaction Amount – Unpaid (a Viewfield)
    • These two Viewfields are of content type “Company”
      • One is filtered to the Transaction paragraph’s status “Paid”; the other is filtered to “Unpaid”.
    • They contain this field, which is SUMmed through Views Aggregation: (field_transactions: Paragraph) SUM(Paragraph: Transaction Amount)
    • They contain these relationships:
    field_projects_paragraph: Paragraph
    (field_projects_paragraph: Paragraph) field_transactions: Paragraph
    (field_projects_paragraph: Paragraph) field_transactions




    

The output displays the sum of the paid or unpaid transactions. For example, if a company has a project which has 3 PAID transactions of $100 each, this view will output “$300”. The intent is to display this value on the “Overview of Transactions” view, as described below:

Overview of Transactions view…

I have created a View of “Company” content of display format: “Table with Aggregation Options” that will display a table of the following columns:

  • Company Title
  • Total Transaction Amount (a SUM aggregation of all transaction “Transaction Amount” values.
  • Total Transaction Amount with status = PAID
  • Total Transaction Amount with status = UNPAID

The intent is to display an at-a-glance table of all Companies on the site, showing a line for each Company, that Company’s Total Transaction amount (which includes paid and unpaid), that company’s PAID total amount, and that company’s UNPAID total amount.

Further, the intent is to be able to filter this table based on the “Year” taxonomy term value from the Transaction paragraph type (filter it to only contain data that is tagged with “2020”, for example), or to filter it by date range using the “Paid On” value from the Transaction paragraph type (filter it to only contain data that contains a date value of 01/01/2020 – 01/03/2020, for example). The purpose is to be able to see all dollar amounts per company on a yearly, monthly, weekly, daily, or any other date range basis. For example: “display all company transaction data for Jan 1, 2020 through March 31, 20020, and then run that same report for that same time period in 2021.

To the View, I added the following settings:

Relationships:

    - field_projects_paragraph: Paragraph
    - (field_projects_paragraph: Paragraph) field_transactions: Paragraph

Filter Criteria:

    Content: Content type (= Company)
    (field_transactions: Paragraph) Paragraph: Year (exposed)
    (field_transactions: Paragraph) Paragraph: Paid On (exposed)

Fields:

    Content: ID (ID) (hidden)
    (field_transactions: Paragraph) Paragraph: ID (ID) (hidden)
    Content: Title (Title)
    (field_transactions: Paragraph) SUM(Paragraph: Transaction Amount) (Transaction Amount)
    Content: Transaction Amount - Paid (Transaction Amount - Paid) - This is one of the Views Field View fields from the Company content type
    Content: Transaction Amount - Unpaid (Transaction Amount - Unpaid) - This is one of the Views Field View fields from the Company content type

Format:Table with aggregation options

        ID: Apply Group Function: Group and Compress
        (field_transactions: Paragraph) Transaction Amount: Column Aggregation: Sum

    

My current end result is as follows:

  • Each Company has its only single line in the table.
  • The “Total
    Transaction Amount” field correctly sums the company’s total
    transactions (paid and unpaid), and the column successfully
    aggregated the total transactions of all Companies on the site.
  • The
    “Content: Transaction Amount – Paid (Transaction Amount – Paid)”
    field correctly displays the company’s total PAID transactions, but
    it does not adhere to the Year and Paid On filters. Additionally, the
    column will not SUM with the Table Aggregation settings at all.
  • The
    “Content: Transaction Amount – Unpaid (Transaction Amount – Paid)”
    field correctly displays the company’s total UNPAID transactions, but
    it does not adhere to the Year and Paid On filters. Additionally, the
    column will not SUM with the Table Aggregation settings at all.

How can I display each company’s Paid and Unpaid transaction totals in this Views aggregated table, and also make those two values subject to the Year and Paid On filters?

I am open to completely re-thinking the organization of the node types, data, etc.

8 – D8 Charts – How do I create an aggregated combo dynamic chart in Views (see photo)

I’m trying to build a chart like this with the CHARTS module…

Chart Example

With 1 content type called “Cars”. The Car node can be categorized with fields for both the “Brand name” and “Model type” (both are taxonomy terms reference fields).

I want to display a column chart showing the number of nodes (inventory, y-axis) for each “Model Type” grouped under the “Brand Name” on the x-axis.

I’m aggregating in views, but can’t for the life of me, figure out how to execute and output such a chart. Please help!

Thanks!

Edit: The key here is “dynamic”… the number of “model types” could go up to 50+… so individual child charts for each model would not work.

aggregate – Should aggregated data include meta data?

I want to create a aggregation job that executes a big db query and flush it into BigQuery.
My question is should I include only the id of the entities (campaign id, advertiser id, user id) or should I include also the meta data (campaign name, advertiser name, user name).

The upside for metadata storing is that I have the whole data in one place.
The downside is that when the metadata been changed (campaign name modified for example) then the whole data should be aggregated again.

Is there a best practice for this kind of situation?

sql server – Insert Multiple Column based on existing table aggregated

I currently have a SQL query that will go through a table, get the distinct dates and then insert the results into another table.

INSERT (fd_movements_dates)(Date)
SELECT DISTINCT(CONVERT(date, MsgTimestamp)) as Date
FROM (fd_movements)
ORDER BY Date

I’m wanting to expand it so that it sums the amount of records within each day. The MsgTimestamp column is a datetime2(0).

Expected result

01-01-2020 – 345600

02-01-2020 – 654000

Thank you.

mysql – Best way to optimize an aggregated issues over time query?

I have a query that creates an aggregated issues over time report that includes back-filling data from entities with missing dates. I’ve been using the following query for a few years but it is starting max out my DB CPU on big datasets. I’m a little lost on what to focus on first and I could use some guidance.

SELECT t1.yearmonth, SUM(rt.errors) as errors, SUM(rt.alerts) as alerts FROM
  (SELECT d.yearmonth, r.user_id, MAX(r.date) as date FROM
    (SELECT DISTINCT  date_add(date, interval  -WEEKDAY(date)-1 day) as yearmonth FROM reports) d
  INNER JOIN reports r ON d.yearmonth >=  date_add(r.date, interval  -WEEKDAY(r.date)-1 day) 
  GROUP BY d.yearmonth, r.user_id ) t1
INNER JOIN reports r1 ON r1.user_id = t1.user_id AND r1.date = t1.date
INNER JOIN report_totals rt ON rt.report_id = r1.id
GROUP BY t1.yearmonth
ORDER BY t1.yearmonth

The example here creates results based on a weekly interval, but my application supports daily, monthly, quarterly, and yearly as well.

I do have a SQL fiddle setup here for further context
http://sqlfiddle.com/#!9/6c7cc82/7

I think the performance hit may be coming from the date_add and date_format functions, but I’m not sure how to accomplish what I’m doing without them. Maybe a calendar table? Any help would be appreciated, thanks!

unit testing – Granular vs a aggregated tests when dealing with arrays

I write code in a Test-Driven way and I often build my functions starting with tests for the easy edge cases.

For example, given a flat array of Items that have a category property, return an array of Groups, each built with all the items for one of the categories in the input.

One edge case I find helpful to test first is the behavior when the items are all from the same category. This gives me a chance to see how the Group should look like.

In this case there are (at least) two approaches one can take: two granular tests vs. a single one.

Granular

One could write two granular tests for these conditions:

  1. Given an array with items all from the same category, the output should be an array with a single group
  2. A group should contain all the items for its category and only those

In Swift, these tests might look something like this

func testGroupingArrayOfSameCategoryReturnsOneGroup() {
    let items = (
        Item(name: "a", category: .foo),
        Item(name: "b", category: .foo),
        Item(name: "c", category: .foo),
    )

    let groups = groupByCategory(items)

    XCTAssertEqual(groups.count, 1)
}

func testGroupingBuildsGroupWithAllItemsForCategory() throws {
    let items = (
        Item(name: "a", category: .foo),
        Item(name: "b", category: .foo),
        Item(name: "c", category: .foo),
    )

    let groups = groupByCategory(items)

    let group = try XCTUnwrap(groups.first)
    XCTAssertEqual(group.category, .foo)
    XCTAssertEqual(group.items.count, 3)
    XCTAssertEqual(group.items(0).name, "a")
    XCTAssertEqual(group.items(1).name, "b")
    XCTAssertEqual(group.items(2).name, "c")
}

I like how the two behaviors of having a 1:1 match with groups and categories and how the groups are built are separated, but I see a lot of duplication between those tests.

Aggregated

A different approach would be to check both facets of the behavior in the same test.

func testGroupingArrayOfSameCategoryReturnsOneGroupWithAllItemsForCategory() {
    let items = (
        Item(name: "a", category: .foo),
        Item(name: "b", category: .foo),
        Item(name: "c", category: .foo),
    )

    let groups = groupByCategory(items)

    XCTAssertEqual(groups.count, 1)
    let group = try XCTUnwrap(groups.first)
    XCTAssertEqual(group.category, .foo)
    XCTAssertEqual(group.items.count, 3)
    XCTAssertEqual(group.items(0).name, "a")
    XCTAssertEqual(group.items(1).name, "b")
    XCTAssertEqual(group.items(2).name, "c")
}

Which do you think is clearer and why?

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies