@itutoring/itutoring_application_js_api 1.3.24 → 1.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/apiController.js CHANGED
@@ -47,24 +47,22 @@ class APIController
47
47
 
48
48
  static ReadUserSource()
49
49
  {
50
+ this.UserSource = CookiesManager.GetCookie("_o");
51
+ if (this.UserSource != null)
52
+ return;
53
+
50
54
  var urlParams = new URLSearchParams(window.location.search);
51
55
  if (urlParams.has("o"))
52
56
  {
53
57
  var source = urlParams.get("o");
54
- if (CookiesManager.GetCookie("_o") == null)
58
+ if (this.UserSource == null)
55
59
  {
56
60
  var date = new Date();
57
61
  date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));
58
62
  CookiesManager.SetCookie("_o", source, date.toUTCString());
59
63
  this.UserSource = source;
60
64
  }
61
- else
62
- {
63
- this.UserSource = CookiesManager.GetCookie("_o");
64
- }
65
65
  }
66
-
67
- console.log("src" + this.UserSource);
68
66
  }
69
67
 
70
68
  /**
@@ -7,6 +7,8 @@ class AttendanceManager
7
7
 
8
8
  static #RETRIVE_ALL_EVENTS = "RetriveAllEvents";
9
9
  static #UPDATE_EVENT = "UpdateEvent";
10
+ static #GET_EVENTS = "GetEvents";
11
+ static #GET_ATTENDANCE_FROM_EVENT = "GetAttendanceFromEvent";
10
12
 
11
13
  static async RetriveAllEvents()
12
14
  {
@@ -46,6 +48,40 @@ class AttendanceManager
46
48
  this.CheckForError(data);
47
49
  }
48
50
 
51
+ static async GetEvents()
52
+ {
53
+ var data = await APIController.Get(this.#MODULE, this.#GET_EVENTS);
54
+ this.CheckForError(data);
55
+
56
+ var ev = new AttendanceEvent();
57
+ ev.CreateFromJSON(JSON.parse(data));
58
+
59
+ return atEvents;
60
+ }
61
+
62
+ static async GetAttendanceFromEvent()
63
+ {
64
+ var data = await APIController.Get(this.#MODULE, this.#GET_ATTENDANCE_FROM_EVENT);
65
+ this.CheckForError(data);
66
+
67
+ data = JSON.parse(data);
68
+ var atEvents = []
69
+ for (const [k0, v0] of Object.entries(value))
70
+ {
71
+ var atEventsStudent = [];
72
+ for (const [k1, v1] of Object.entries(v0))
73
+ {
74
+ var ev = new AttendanceEvent();
75
+ ev.CreateFromJSON(JSON.parse(v1));
76
+ atEventsStudent.push(ev);
77
+ }
78
+
79
+ atEvents.push(atEventsStudent);
80
+ }
81
+
82
+ return atEvents;
83
+ }
84
+
49
85
  static async CheckForError(data)
50
86
  {
51
87
  if (data.includes("error: "))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.3.24",
3
+ "version": "1.3.26",
4
4
  "description": "Javascript API for iTutoring Application",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",