Skip to content

Commit

Permalink
update expected files and fix for week dimension values
Browse files Browse the repository at this point in the history
  • Loading branch information
diosmosis committed May 9, 2024
1 parent cd97196 commit c3fcf28
Show file tree
Hide file tree
Showing 103 changed files with 2,873 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,8 @@ export function getData(request: GoogleAppsScript.Data_Studio.Request<ConnectorP
value = value.toString().split('-').slice(0, 2).join('');
} else if (matomoType === 'date_week') {
// value is in YYYY-MM-DD, but must be converted to YYYYww
value = value.toString().split('-').shift() + dayjs(value).week();
const start = value.split(',')[0];
value = start.toString().split('-').shift() + dayjs(start).week();
} else if (matomoType === 'date_year') {
value = value.toString().split('-').shift();
} else if (matomoType === 'datetime') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"filtersApplied": false,
"rows": [
{
"values": [
"202302",
"1220",
"Cart change",
"added - Diving Tank",
"2"
]
},
{
"values": [
"202302",
"1087",
"Cart change",
"added - Basic Wetsuit",
"2"
]
},
{
"values": [
"202302",
"986",
"Cart change",
"added - Scuba Fins",
"2"
]
},
{
"values": [
"202302",
"495",
"Cart change",
"added - Diving Knife",
"3"
]
},
{
"values": [
"202302",
"6492",
"Others",
"Others",
"11852"
]
}
],
"schema": [
{
"dataType": "STRING",
"label": "Month",
"name": "date_month",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH"
}
},
{
"dataType": "NUMBER",
"label": "Events",
"name": "nb_events",
"semantics": {
"conceptType": "METRIC",
"isReaggregatable": false,
"semanticType": "NUMBER"
}
},
{
"dataType": "STRING",
"label": "Event Action",
"name": "Events_EventAction",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "TEXT"
}
},
{
"dataType": "STRING",
"label": "Event Name",
"name": "Events_EventName",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "TEXT"
}
},
{
"dataType": "NUMBER",
"label": "Maximum Event value",
"name": "max_event_value",
"semantics": {
"conceptType": "METRIC",
"isReaggregatable": false,
"semanticType": "NUMBER"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"filtersApplied": false,
"rows": [
{
"values": [
"2023",
"85046",
"Cart change",
"added - Diving Tank",
"4"
]
},
{
"values": [
"2023",
"80792",
"Cart change",
"added - Basic Wetsuit",
"4"
]
},
{
"values": [
"2023",
"51448",
"Cart change",
"added - Scuba Fins",
"4"
]
},
{
"values": [
"2023",
"31860",
"Cart change",
"added - Diving Boots",
"2"
]
},
{
"values": [
"2023",
"358771",
"Others",
"Others",
"26069"
]
}
],
"schema": [
{
"dataType": "STRING",
"label": "Year",
"name": "date_year",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR"
}
},
{
"dataType": "NUMBER",
"label": "Events",
"name": "nb_events",
"semantics": {
"conceptType": "METRIC",
"isReaggregatable": false,
"semanticType": "NUMBER"
}
},
{
"dataType": "STRING",
"label": "Event Action",
"name": "Events_EventAction",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "TEXT"
}
},
{
"dataType": "STRING",
"label": "Event Name",
"name": "Events_EventName",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "TEXT"
}
},
{
"dataType": "NUMBER",
"label": "Maximum Event value",
"name": "max_event_value",
"semantics": {
"conceptType": "METRIC",
"isReaggregatable": false,
"semanticType": "NUMBER"
}
}
]
}
27 changes: 27 additions & 0 deletions tests/appscript/expected/schema_Actions.get.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,33 @@
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH_DAY"
}
},
{
"dataType": "STRING",
"label": "Month",
"name": "date_month",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH"
}
},
{
"dataType": "STRING",
"label": "Week (Mon - Sun)",
"name": "date_week",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_WEEK"
}
},
{
"dataType": "STRING",
"label": "Year",
"name": "date_year",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR"
}
}
]
}
27 changes: 27 additions & 0 deletions tests/appscript/expected/schema_Actions.getDownloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,33 @@
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH_DAY"
}
},
{
"dataType": "STRING",
"label": "Month",
"name": "date_month",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH"
}
},
{
"dataType": "STRING",
"label": "Week (Mon - Sun)",
"name": "date_week",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_WEEK"
}
},
{
"dataType": "STRING",
"label": "Year",
"name": "date_year",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR"
}
}
]
}
27 changes: 27 additions & 0 deletions tests/appscript/expected/schema_Actions.getEntryPageTitles.json
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,33 @@
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH_DAY"
}
},
{
"dataType": "STRING",
"label": "Month",
"name": "date_month",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH"
}
},
{
"dataType": "STRING",
"label": "Week (Mon - Sun)",
"name": "date_week",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_WEEK"
}
},
{
"dataType": "STRING",
"label": "Year",
"name": "date_year",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR"
}
}
]
}
27 changes: 27 additions & 0 deletions tests/appscript/expected/schema_Actions.getEntryPageUrls.json
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,33 @@
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH_DAY"
}
},
{
"dataType": "STRING",
"label": "Month",
"name": "date_month",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH"
}
},
{
"dataType": "STRING",
"label": "Week (Mon - Sun)",
"name": "date_week",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_WEEK"
}
},
{
"dataType": "STRING",
"label": "Year",
"name": "date_year",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR"
}
}
]
}
27 changes: 27 additions & 0 deletions tests/appscript/expected/schema_Actions.getExitPageTitles.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH_DAY"
}
},
{
"dataType": "STRING",
"label": "Month",
"name": "date_month",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_MONTH"
}
},
{
"dataType": "STRING",
"label": "Week (Mon - Sun)",
"name": "date_week",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR_WEEK"
}
},
{
"dataType": "STRING",
"label": "Year",
"name": "date_year",
"semantics": {
"conceptType": "DIMENSION",
"semanticType": "YEAR"
}
}
]
}
Loading

0 comments on commit c3fcf28

Please sign in to comment.