Commit a1ce8ff1 by Arturo Montejo Ráez

Merge branch 'develop' of http://gitlab.ujaen.es/yotta/pictogram into develop

parents a531b792 d07c1f4a
...@@ -192,9 +192,9 @@ public class Device extends SQLiteOpenHelper { ...@@ -192,9 +192,9 @@ public class Device extends SQLiteOpenHelper {
* @return * @return
* @throws JSONException * @throws JSONException
*/ */
public Boolean isSupervisorOnLocal(int id_sup) throws JSONException{ public Boolean isSupervisorOnLocal(int id_sup,int id_stu) throws JSONException{
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(" SELECT * FROM supervisor WHERE id = " + id_sup, null); Cursor cursor = db.rawQuery(" SELECT * FROM users_detail WHERE id_stu = " + id_stu+ " AND id_sup ="+id_sup, null);
if(cursor.moveToFirst()) if(cursor.moveToFirst())
return true; return true;
cursor.close(); cursor.close();
...@@ -213,7 +213,7 @@ public class Device extends SQLiteOpenHelper { ...@@ -213,7 +213,7 @@ public class Device extends SQLiteOpenHelper {
Hashtable<String, String> users = new Hashtable<>(3); Hashtable<String, String> users = new Hashtable<>(3);
Cursor cursor = db.rawQuery(" SELECT email_sup, name_sup, surname_sup,id_sup FROM users_detail WHERE id_stu = "+id_stu ,null); Cursor cursor = db.rawQuery(" SELECT email_sup, name_sup, surname_sup,id_sup FROM users_detail WHERE id_stu = "+id_stu ,null);
while (cursor.moveToNext()) while (cursor.moveToNext())
users.put(cursor.getString(0), cursor.getString(1)+", "+cursor.getString(2)+";"+cursor.getInt(3)); users.put(cursor.getString(0), cursor.getString(1) + ", " + cursor.getString(2) + ";" + cursor.getInt(3));
cursor.close(); cursor.close();
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ //db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
return users; return users;
......
...@@ -18,7 +18,6 @@ import com.yottacode.pictogram.dao.User; ...@@ -18,7 +18,6 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.ImgDownloader; import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper.EditPictoActivity;
import com.yottacode.pictogram.tools.Img; import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools; import com.yottacode.tools.GUITools;
...@@ -28,9 +27,7 @@ import org.json.JSONException; ...@@ -28,9 +27,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List;
import java.util.Vector; import java.util.Vector;
/** /**
...@@ -243,7 +240,7 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -243,7 +240,7 @@ public class StudentFragmentGrid extends Fragment{
try { try {
supervisor = supervisors.getJSONObject(i); supervisor = supervisors.getJSONObject(i);
idSupervisoresJSON.add(supervisor.getString("email")); idSupervisoresJSON.add(supervisor.getString("email"));
if(!PCBcontext.getDevice().isSupervisorOnLocal((int) supervisor.get("id"))) {//Para comprobar si ya existe en local if(!PCBcontext.getDevice().isSupervisorOnLocal((int) supervisor.get("id"),stu_id)) {//Para comprobar si ya existe en local
User currentUser = PCBcontext.getPcbdb().getCurrentUser(); User currentUser = PCBcontext.getPcbdb().getCurrentUser();
PCBcontext.getDevice().insertUser(new User(stu_id, currentUser.get_nickname_stu(), currentUser.get_pwd_stu() PCBcontext.getDevice().insertUser(new User(stu_id, currentUser.get_nickname_stu(), currentUser.get_pwd_stu()
, currentUser.get_name_stu(),currentUser.get_surname_stu(),currentUser.get_active_scene(), currentUser.get_url_img_stu() , currentUser.get_name_stu(),currentUser.get_surname_stu(),currentUser.get_active_scene(), currentUser.get_url_img_stu()
...@@ -322,7 +319,7 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -322,7 +319,7 @@ public class StudentFragmentGrid extends Fragment{
GUITools.show_alert(getActivity(), R.string.loginErrorTxt,getString(R.string.noStudentsError), new GUITools.iOKListener() { GUITools.show_alert(getActivity(), R.string.loginErrorTxt,getString(R.string.noStudentsError), new GUITools.iOKListener() {
@Override @Override
public void ok() { public void ok() {
PCBcontext.getNetService().restart_app(false); PCBcontext.getNetService().restart_app(true);
} }
}); });
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_below="@+id/loginTopbarLayout" android:layout_below="@+id/loginTopbarLayout"
android:background="#eeeeee"
android:paddingTop="10dp"> android:paddingTop="10dp">
<fragment <fragment
......
...@@ -8,17 +8,17 @@ ...@@ -8,17 +8,17 @@
tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.SplashScreenActivity" > tools:context="com.yottacode.pictogram.tabletlibrary.gui.login.SplashScreenActivity" >
<ImageView <ImageView
android:id="@+id/imageView2"
android:layout_width="400px" android:layout_width="400px"
android:layout_height="120px" android:layout_height="120px"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="44dp"
android:contentDescription="@string/app_name" android:contentDescription="@string/app_name"
android:orientation="vertical" android:orientation="vertical"
android:src="@drawable/yottacode_logo"
android:scaleX="0.5" android:scaleX="0.5"
android:scaleY="0.5" android:scaleY="0.5"
android:id="@+id/imageView2" android:src="@drawable/yottacode_logo" />
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="44dp" />
<ImageView <ImageView
android:layout_width="200px" android:layout_width="200px"
......
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
android:id="@+id/loginStudentGridView" android:id="@+id/loginStudentGridView"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#eeeeee"
android:numColumns="5" android:numColumns="5"
android:stackFromBottom="false" /> android:stackFromBottom="false" />
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<ListView <ListView
android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@android:id/list" /> android:background="#eeeeee" />
</LinearLayout> </LinearLayout>
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<ListView <ListView
android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@android:id/list" /> android:background="#eeeeee" />
</LinearLayout> </LinearLayout>
...@@ -264,9 +264,10 @@ thisTrigger: BEGIN ...@@ -264,9 +264,10 @@ thisTrigger: BEGIN
-- Show and resumesession actions creates new tries -- Show and resumesession actions creates new tries
CASE NEW.type CASE NEW.type
WHEN 'Show' THEN WHEN 'Show' THEN
IF (idopentry IS NOT NULL) THEN
INSERT INTO try(`id_ws`) INSERT INTO try(`id_ws`)
VALUES (idws); VALUES (idws);
END IF;
WHEN 'pausesession' THEN WHEN 'pausesession' THEN
...@@ -276,7 +277,12 @@ thisTrigger: BEGIN ...@@ -276,7 +277,12 @@ thisTrigger: BEGIN
result = 'DISCARDED' result = 'DISCARDED'
WHERE WHERE
id = idopentry; id = idopentry;
END IF;
UPDATE stu_opentry
SET id_opentry=NULL
WHERE id_ws = idws;
END IF;
WHEN 'resumesession' THEN WHEN 'resumesession' THEN
......
...@@ -1438,7 +1438,7 @@ module.exports = { ...@@ -1438,7 +1438,7 @@ module.exports = {
Action.create({ Action.create({
type: action, type: action,
timestamp: attributes.timestamp, // it comes already in ISO format timestamp: new Date().toISOString(), // it comes already in ISO format
supervisor: sup, supervisor: sup,
student: attributes.id_stu, student: attributes.id_stu,
description: desc description: desc
......
...@@ -235,22 +235,35 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr ...@@ -235,22 +235,35 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope.wsessions[$scope.wsessions.length-1].tries.pop(); $scope.wsessions[$scope.wsessions.length-1].tries.pop();
$scope.ws.end = new Date(); $scope.ws.end = new Date();
$http
.post(
config.backend+'/ws/' + $scope.ws.id + '/close',
{
"id_stu": $scope.studentData.id
}
)
.success(function(data, status, headers, config) {
// Empty actual WS and actual try $http
$scope.ws = {}; .post(config.backend+'/action', {
$scope.actual_try = {}; "type": "endsession",
}) "student": $scope.studentData.id,
.error(function(data, status, headers, config) { "supervisor": $scope.user.id,
})
.success(function(data, status, headers, _config) {
// Adding resume action to the list of actions
$scope.actual_try.actions.push({ action: 'endsession'} );
}); $http.post(config.backend+'/ws/' + $scope.ws.id + '/close',
{
"id_stu": $scope.studentData.id
}
)
.success(function(data, status, headers, config) {
// Empty actual WS and actual try
$scope.ws = {};
$scope.actual_try = {};
})
.error(function(data, status, headers, config) {
});
})
.error(function(data, status, headers, config) {
});
// Cancel the mark of the device connected (with a new session will be connected again) // Cancel the mark of the device connected (with a new session will be connected again)
//$scope.active_device = null; //$scope.active_device = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment