diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/404.html b/404.html new file mode 100644 index 000000000..4a69dcfab --- /dev/null +++ b/404.html @@ -0,0 +1,2852 @@ + + + +
+ + + + + + + + + + + + + + +Celery needs an object called application, this object is bound with a set of configurations like the Message Broker or task queue, theoretically you should have many celery apps and bound your tasks to one or many of those apps, actually we had not got any use to this feature and we rather use the shared_task decorator instead which just support one application.
+Read this.
+It where in breathecode/celery.py
.
Celery allows configure some tasks to be executed repeatedly separate by a period of time, it usually did not use in favor of Django commands.
+Read this.
+ + + + + + + + + + + + + +Celery allows set custom routing to call its tasks, it is usually used when you use Celery as a Message Broker, actually use Celery for this purpose is complicated because Celery does not support other Programming languages, so, you would have to use the Message Broker that Celery is using instead.
+Read this.
+ + + + + + + + + + + + + +This API uses Google DataStore as storage, there is not local storage on Heroku or Postgres.
+We need Google DataStore because we plan to store huge amounts of activities that the user can do inside breathecode.
+Possible activities (so far): +
"breathecode_login" //every time it logs in
+"online_platform_registration" //first day using breathecode
+"public_event_attendance" //attendy on an eventbrite event
+"classroom_attendance" //when the student attent to class
+"classroom_unattendance" //when the student miss class
+"lesson_opened" //when a lessons is opened on the platform
+"office_attendance" //when the office raspberry pi detects the student
+"nps_survey_answered" //when a nps survey is answered by the student
+"exercise_success" //when student successfully tests exercise
+
Any activity has the following inputs:
+ +Get recent user activity +
+Add a new user activity (requires authentication) +
POST: activity/user/{email_or_id}
+{
+ 'slug' => 'activity_slug',
+ 'data' => 'any aditional data (string or json-encoded-string)'
+}
+
+💡 Node: You can pass the cohort in the data json object and it will be possible to filter on the activity graph like this:
+
+{
+ 'slug' => 'activity_slug',
+ 'data' => "{ \"cohort\": \"mdc-iii\" }" (json encoded string with the cohort id)
+}
+
Endpoints for the Cohort
+Get recent user activity +
+Endpoints for the coding_error's + +Add a new coding_error (requires authentication)
+POST: activity/coding_error/
+
+{
+ "user_id" => "my@email.com",
+ "slug" => "webpack_error",
+ "data" => "optional additional information about the error",
+ "message" => "file not found",
+ "name" => "module-not-found,
+ "severity" => "900",
+ "details" => "stack trace for the error as string"
+}
+
This module take care of the academic side of breathecode: Students, Cohorts, Course (aka: Certificate), Syllabus, etc. These are some of the things you can do with the breathecode.admissions API:
+TODO: finish this documentation.
+Override previous academies +
+This app is ideal for running diagnostic and reminders on the breathecode platform.
+Setup the monitor app job for once a day, this is the command: +
+Setup the monitor script job for once a day, this is the command: +
+A monitoring script is something that you want to execute recurrently withing the breathecode API, for example:
+scripts/alert_pending_leads.py
is a small python script that checks if there is FormEntry Marketing module database that are pending processing.
You can create a monitoring script to remind academy staff members about things, or to remind students about pending homework, etc.
+./breathecode/monitoring/scripts
#!/usr/bin/env python
+"""
+Alert when there are Form Entries with status = PENDING
+"""
+from breathecode.utils import ScriptNotification
+# start your code here
+
ScriptNotification
to notify for MINOR
or CRITICAL
reasons, for example:# here we are raising a notification because there are 2 pending tasks
+raise ScriptNotification("There are 2 pending taks", status='MINOR', slug="pending_tasks")
+
There are some global variables that you have available during your scripts:
+Variable name | +Value | +
---|---|
academy | +Contains the academy model object, you can use it to retrieve the current academy id like this: query.filter(academy__id=academy.id) |
+
You can test your scripts by running the following command:
+$ python manage.py run_script <file_name>
+
+# For example you can test the alert_pending_leads script like this:
+$ python manage.py run_script alert_pending_leads.py
+
The following script checks for pending leads to process:
+#!/usr/bin/env python
+"""
+Alert when there are Form Entries with status = PENDING
+"""
+from breathecode.marketing.models import FormEntry
+from django.db.models import Q
+from breathecode.utils import ScriptNotification
+
+# check the database for pending leads
+pending_leads = FormEntry.objects.filter(storage_status="PENDING").filter(Q(academy__id=academy.id) | Q(location=academy.slug))
+
+# trigger notification because pending leads were found
+if len(pending_leads) > 0:
+ raise ScriptNotification(f"Warning there are {len(pending_leads)} pending form entries", status='MINOR')
+
+# You can print this and it will show on the script results
+print("No pending leads")
+
from breathecode.monitoring.actions import run_script
+script = run_script(model.monitor_script)
+
+del script['slack_payload']
+del script['title']
+
+expected = {'details': script['details'],
+ 'severity_level': 5,
+ 'status': script['status'],
+ 'text': script['text']
+ }
+
+self.assertEqual(script, expected)
+
+self.assertEqual(self.all_monitor_script_dict(), [{
+ **self.model_to_dict(model, 'monitor_script'),
+}])
+