Schedule localnotificacion on specific days ionic 2 - ionic2

I have an Ionic 2 app that schedules notifications with: LocalNotificacions
I create notifications like:
let options = {
id: reminder.id,
text: this.NOTIFICATION_TEXT,
at: reminder.date,
sound: this.notifySoundPath,
every: "day",
data: notificationData
};
And it schedules notifications that repeat every day at this time.
Now, I need to create notifications that repeat in specific days. The user should can select dates such monday, tuesday, wednesday,etc. And I need to be able to schedule reminders that will repeat on these days.
Can I do it with this plugin?
Thank's in advance.

Related

Bigquery, how to count events group by week?

I just started working with Bigquery. Data comes from firebase and I noticed that I got the data each day, for example gara-e78a5.analytics_247657392.events_20221231, gara-e78a5.analytics_247657392.events_20221230 etc....
Each row comes with an event_date like under this format 20221231
I want to count the number of people landing on our page each week, but I don't know I to group them by week.
I started something like this but I don't know to group it by week:
SELECT count(event_name) FROM app-xxxx.analytics_247657392.events_* where event_name = 'page_download_view' group by
Thanks in advance for your help
Based on #Ronak, i found the solution.
SELECT week_of_year, sum(nb_download) as nb_download_per_week from (
SELECT DISTINCT EXTRACT (WEEK from (PARSE_DATE('%Y%m%d', event_date))) as week_of_year, count(event_name) as nb_download from `tabllle-e78a5.analytics_XXXXX.events_*` where event_name = 'landing_event_download_apk' group by event_date) group by week_of_year
You can use the WEEK (or ISOWEEK) function.
WEEK: Returns the week number of the date in the range [0, 53]
More: https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions
Formats - https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#format_timestamp
This should work
select EXTRACT(ISOWEEK FROM(CAST(PARSE_DATE('%Y%m%d', <column>) as TIMESTAMP))) as week_of_year from <table>
Output

Cannot access the push dataset from power bi custom connector

I've created a custom connector that uses authorization flow to connect to third-party APIs and I use an enterprise gateway to schedule the refresh for the dataset. The issue with that is, that the old dataset is being replaced by the new dataset after every refresh. I have scheduled the refresh to run every 1 hour. So at the end of the day, I lose all the reports. So as a solution for this, I created a push dataset which I believe is backed up by a DB, and using the rest API I'm pushing the refreshed data to the push dataset. Below is the code for that.
pushdataset = (data) =>
let
headers = [RelativePath = "https://api.powerbi.com", IsRetry=true, Headers = [
#"Content-Type"="application/json", Accept="application/json"
], Content = Json.FromValue(data)],
response = Web.Contents("/beta/77777/datasets/66789900/rows?key=ccccc", headers),
in
response;
expandTable = () =>
let
TableFromList = Table.FromList(reportEntries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
ExpandColumn = Table.ExpandRecordColumn(TableFromList, "Column1", {"category"},{ "Column1.category"})
in
ExpandColumn
When I execute the connector I get
"Access is forbidden 403" error. It seems like a simple HTTP request, I can access the dataset using the python code and also from the postman.
I'm stuck with this for a long time. How do we connect to the push dataset from the custom connector? Also if there are other ways to keep the existing data and append new data to the dataset after every refresh, please let me know.
Example:
Scheduler runs at 9am
Data stored in the dataset
Category Total Item
Bike 1
Mobile 2
Scheduler runs at 10am
Data stored in the dataset**
Category Total Item
Watch 10
Books 2
What is expected:
Category Total Item
Bike 1
Mobile 2
Watch 10
Books 2

User login and logout in Dynamodb

The requirement is to store employees login and logout information in DynamoDB.
If an employee works for more than 4 hours a day (it might be at a stretch or with breaks in between) need to notify the employee to log off for that day and take a break. Since I need to poll DB to check if 4 hours is completed for a day or no and for this I don't want to use DB scan approach. This is how my DDb looks, but in order to poll every 10 minutes, since I can't make use of scan. How can I achieve it? Any suggestions are helpful.
Employee Number
Event DateTime
Action
Worked hours
abc
24/6/2022 9AM
Login
0
abc
24/6/2022 12PM
Logout
3
abc
24/6/2022 2PM
Login
3
I suggest you set the empId as a parition key and create a global secondary index including status and status update date
Primary Index:
Partition key: empId
Global Secondary Index:
Partition key: status ('loggedOut' or 'loggedIn')
Sort Key: statusUpdateDate (epochTime in seconds)
Run a cron job in eventbridge to trigger lambda every 5 min
In the lambda function run the following query to find the employees that are loggedIn for more than 4 hours by the following query:
ddbClient.query({
TableName: 'tableName',
IndexName: "gsiName",
KeyConditionExpression: "status = :loggedIn and statusUpdateDate < :currentTimeMinus4Hours",
ExpressionAttributeValues: {
":loggedIn ": "loggedIn",
":currentTimeMinus4Hours": moment().utc().unix() - 14400, // now - 4 hours
},
})

How to count active customers using start and end date in Power-BI?

Newbie here to Power-BI. I have a project where I need to count the number of active customers per month based on the Start_date and exit_date. There are some customers that do not yet have an exit date as they are still active/ haven't yet exited.
If all you want to do is count the customers that have no exit date (active customers), this worked for me:
CountActive = COUNTBLANK('your table'[EXIT_DATE])
If you want to show the active customers based on the start date you can simply use a slicer with START_DATE. The measure will automatically update the count of active customers.
If you want to show the customers that already exited (non active customers) you could do the following:
CountNonBlank = COUNTROWS('your table') - COUNTBLANK('your table'[END_DATE])
Again, just simply add a slicer to show count depending on start date.
Hope this helps

Sorting events to show this week, month etc

I have a list of events but I'm struggling to work out how to show specific date ranges in the index view.
I would like to list the events by showing events today, this week, this month etc.
I'm new to rails so I've tried to use this site and I've come up with the following which works for today's events.
#events_today = Event.find(:all, :conditions => ["date between ? and ?", Date.today, Date.tomorrow])
But I'm not sure how to set the page to automatically update and show only this weeks events and this month.
Your basic query should do something like this:
Event.where(date: date_range)
Now before calling this query you can set the date range variable. If you only want this week:
date_range = Date.today.beginning_of_week..Date.today
Event.where(date: date_range)
Now there are all sorts of things you can do. You can select a start and end date or a custom period using either a form or a dropdown select. In this case date_range is set based on your params. You could also always use one predefined period.
If you want to work with several date range periods it could be nice to have a last_week, last_month, etc. scope in your model (or concern). Or you could simply define date_range constants in your initializers.
As per my understanding, you want to show all the event of a week or month on click of tab 'Week' or 'Month' from view.
When you clicked on month or week for getting events, you send simply month or week in params(assuming params[:events_in] hold 'week' or 'month')
apply check on this attributes of params
def get_events_in_week_or_month
if params[:events_in] =='week'
start_date_of_time_period = Date.today.beginning_of_week
end_date_of_time_period = Date.today.end_of_week
else
start_date_of_time_period = Date.today.beginning_of_month
end_date_of_time_period = Date.today.end_of_month
end
#events in descending order
#events = Event.where("date between ? and ? ", start_date_of_time_period, end_date_of_time_period).order("created_at DESC")
#events in ascending order
#events = Event.where("date between ? and ? ", start_date_of_time_period, end_date_of_time_period)
end
for getting more methods of date class, you should run following command on rails console :
Date.public_methods