Commit 0828fa6f by Arturo Montejo Ráez

Merge branch 'develop' of http://scm.ujaen.es/softuno/pictogram into develop

parents 2406e79c c2718338
Showing with 498 additions and 866 deletions
...@@ -90,7 +90,7 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -90,7 +90,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
private void setCurrentUser(User user) { private void setCurrentUser(User user) {
this.currentUser = user; this.currentUser = user;
PCBcontext.getDevice().setLastStuId(user.get_id_stu()); PCBcontext.getDevice().setLastStuId(user.get_id_stu());
PCBcontext.getDevice().setLastSupId(user.get_id_sup()); if (user.is_supervisor()) PCBcontext.getDevice().setLastSupId(user.get_id_sup());
} }
/** /**
......
package com.yottacode.pictogram.net; package com.yottacode.pictogram.net;
import android.content.Intent;
import android.util.Log; import android.util.Log;
import com.yottacode.net.RestapiWrapper; import com.yottacode.net.RestapiWrapper;
...@@ -98,6 +99,10 @@ public class NetService implements Runnable { ...@@ -98,6 +99,10 @@ public class NetService implements Runnable {
PCBcontext.unset_user(); PCBcontext.unset_user();
this.device.restart_app(); this.device.restart_app();
} }
public void restart_app(Intent intent) {
PCBcontext.unset_user();
this.device.restart_app(intent);
}
/** /**
* ping to the server by using a restapi call. If ok, the call will return the empty set * ping to the server by using a restapi call. If ok, the call will return the empty set
......
package com.yottacode.pictogram.net; package com.yottacode.pictogram.net;
import android.content.Intent;
/** /**
* Created by Fernando on 12/08/2016. * Created by Fernando on 12/08/2016.
*/ */
...@@ -9,4 +11,5 @@ public interface iNetServiceDevice { ...@@ -9,4 +11,5 @@ public interface iNetServiceDevice {
public void notifyStatus(boolean updated); public void notifyStatus(boolean updated);
public void closeNotifyStatus(); public void closeNotifyStatus();
public void restart_app(); public void restart_app();
public void restart_app(Intent intent);
} }
...@@ -209,8 +209,8 @@ INSTEAD OF INSERT ON users_detail ...@@ -209,8 +209,8 @@ INSTEAD OF INSERT ON users_detail
FOR EACH ROW FOR EACH ROW
WHEN NEW.pwd_stu IS NULL WHEN NEW.pwd_stu IS NULL
BEGIN BEGIN
INSERT OR REPLACE INTO student(id,nickname, name, surname, url_img, gender, lang, attributes) INSERT OR REPLACE INTO student(id,nickname, pwd, name, surname, url_img, gender, lang, attributes)
VALUES (NEW.id_stu, NEW.nickname_stu, NEW.name_stu, NEW.surname_stu, NEW.url_img_stu, NEW.gender_stu, NEW.lang_stu, NEW.attributes_stu); VALUES (NEW.id_stu, NEW.nickname_stu, (SELECT pwd FROM student WHERE id=NEW.id_stu), NEW.name_stu, NEW.surname_stu, NEW.url_img_stu, NEW.gender_stu, NEW.lang_stu, NEW.attributes_stu);
INSERT OR REPLACE INTO supervisor VALUES (NEW.id_sup, NEW.email_sup, NEW.pwd_sup, NEW.name_sup, NEW.surname_sup, NEW.url_img_sup, NEW.gender_sup, NEW.lang_sup, NEW.tts_engine_sup); INSERT OR REPLACE INTO supervisor VALUES (NEW.id_sup, NEW.email_sup, NEW.pwd_sup, NEW.name_sup, NEW.surname_sup, NEW.url_img_sup, NEW.gender_sup, NEW.lang_sup, NEW.tts_engine_sup);
INSERT OR REPLACE INTO users VALUES (NEW.id_stu,NEW.id_sup); INSERT OR REPLACE INTO users VALUES (NEW.id_stu,NEW.id_sup);
END END
......
...@@ -6,6 +6,7 @@ import android.content.ClipData; ...@@ -6,6 +6,7 @@ import android.content.ClipData;
import android.content.ClipDescription; import android.content.ClipDescription;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
...@@ -31,6 +32,7 @@ import android.widget.ImageButton; ...@@ -31,6 +32,7 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.iImgDownloaderListener; import com.yottacode.pictogram.net.iImgDownloaderListener;
import com.yottacode.pictogram.tablet.R; import com.yottacode.pictogram.tablet.R;
import com.yottacode.pictogram.action.PictosAction; import com.yottacode.pictogram.action.PictosAction;
...@@ -43,18 +45,22 @@ import com.yottacode.pictogram.net.PictoUploader; ...@@ -43,18 +45,22 @@ import com.yottacode.pictogram.net.PictoUploader;
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 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.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
public class PictogramActivity extends Activity implements iVocabularyListener, TextToSpeech.OnInitListener { public class PictogramActivity extends Activity implements iVocabularyListener, TextToSpeech.OnInitListener {
public static final String PREFS_NAME = "MyPrefsFile";
// Main layout for this activity // Main layout for this activity
RelativeLayout mainLayout; RelativeLayout mainLayout;
// Adapter for de grid showing the categories grid (and main pictos) // Adapter for de grid showing the categories grid (and main pictos)
...@@ -736,13 +742,54 @@ public class PictogramActivity extends Activity implements iVocabularyListener, ...@@ -736,13 +742,54 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
private class OnDeleteButtonLongClickListener implements View.OnLongClickListener { private class OnDeleteButtonLongClickListener implements View.OnLongClickListener {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
count_deletelong++; count_deletelong++;
if (count_deletelong >= 3) {
//TODO: COMPROBAR SI LOS USUARIOS QUE BUSCO EXISTEN: SI NO PONER LOS DATOS POR DEFECTO*******************************************************************/
//Cojo los id del ultimo estudiante y el ultimo supervisor
int lastIdStu = PCBcontext.getDevice().getLastStuId();
User actual = PCBcontext.getPcbdb().getCurrentUser();
User usuario_anterior;
String lastUserName = null;
String lastPassword= null;
if (count_deletelong >= 3) { if (actual.is_supervisor()) //Si el que habia es supervisor busco el ultimo niño
PictogramActivity.this.finish(); try {
PCBcontext.getNetService().restart_app(); usuario_anterior = PCBcontext.getDevice().findUser(lastIdStu,User.NO_SUPERVISOR);
if(usuario_anterior!=null){
lastUserName = usuario_anterior.get_nickname_stu();
lastPassword = usuario_anterior.get_pwd_stu();
}
} catch (JSONException e) {
e.printStackTrace();
}
else {
int lastIdSup = PCBcontext.getDevice().getLastSupId();
try {
usuario_anterior = PCBcontext.getDevice().findUser(lastIdStu,lastIdSup);
if(usuario_anterior!=null){
lastUserName = usuario_anterior.get_email_sup();
lastPassword = usuario_anterior.get_pwd_sup();
}
} catch (JSONException e) {
e.printStackTrace();
}
} }
return false;
Intent serialActivity = new Intent(getBaseContext(), SerialActivity.class);
if (lastUserName!=null) {
Log.i(this.getClass().getCanonicalName(), "Switch user to "+ lastUserName);
serialActivity.putExtra("switch_usr", lastUserName);
serialActivity.putExtra("switch_pwd", lastPassword);
}
PictogramActivity.this.finish();
PCBcontext.getNetService().restart_app(serialActivity);
}
return false;
} }
} }
......
...@@ -4,6 +4,7 @@ import android.app.Activity; ...@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.Window; import android.view.Window;
...@@ -25,12 +26,24 @@ public class SerialActivity extends Activity { ...@@ -25,12 +26,24 @@ public class SerialActivity extends Activity {
// String constant for logs // String constant for logs
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName() private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
public static void resetDefaultUser() {
SharedPreferences settings = PCBcontext.getContext().getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("username", "");
editor.putString("password", "");
/**
* Return the default user+pwd when login.The policy is
* 1. switch user
* 2. last user
* @return user+pwd to be used
*/
private String[] loginUserPolicy() {
Intent intent=getIntent();
String username = intent.getStringExtra("switch_usr");
String password = intent.getStringExtra("switch_pwd");
if (username==null) {
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
username = settings.getString("username", "");
password = settings.getString("password", "");
}
return new String[]{username,password};
} }
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -38,21 +51,25 @@ public class SerialActivity extends Activity { ...@@ -38,21 +51,25 @@ public class SerialActivity extends Activity {
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_serial); setContentView(R.layout.activity_serial);
Intent intent=getIntent();
final EditText mSerialViewMail = (EditText) findViewById(R.id.serialmail); final EditText mSerialViewMail = (EditText) findViewById(R.id.serialmail);
final EditText mSerialViewPass = (EditText) findViewById(R.id.serialpass); final EditText mSerialViewPass = (EditText) findViewById(R.id.serialpass);
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); String default_user[]=loginUserPolicy();
String username = settings.getString("username", ""); String username=default_user[0];
String password = intent.getBooleanExtra("resetPrevUser", true) ? "" : settings.getString("password", ""); String password=default_user[1];
// Escribo el último valor indicado de username
mSerialViewMail.setText(username);
mSerialViewPass.setText(password);
// Escribo el último valor indicado de username // Escribo el último valor indicado de username
mSerialViewMail.setText(username); mSerialViewMail.setText(username);
if (!username.equals("") && !password.equals("")) new UserLogin().login(username, password,SerialActivity.this, PictogramActivity.class, LoginActivity.class);; if (!username.equals("") && !password.equals("") && !getIntent().getBooleanExtra("resetPrevUser", true)) new UserLogin().login(username, password,SerialActivity.this, PictogramActivity.class, LoginActivity.class);
Button mEntrarButton = (Button) findViewById(R.id.entrar_button); Button mEntrarButton = (Button) findViewById(R.id.entrar_button);
mEntrarButton.setOnClickListener(new OnClickListener() { mEntrarButton.setOnClickListener(new OnClickListener() {
...@@ -66,6 +83,7 @@ public class SerialActivity extends Activity { ...@@ -66,6 +83,7 @@ public class SerialActivity extends Activity {
editor.putString("username", username); editor.putString("username", username);
editor.putString("password", password); editor.putString("password", password);
editor.commit(); editor.commit();
if (!username.equals("") && !password.equals(""))
new UserLogin().login(username, password,SerialActivity.this, PictogramActivity.class, LoginActivity.class); new UserLogin().login(username, password,SerialActivity.this, PictogramActivity.class, LoginActivity.class);
} }
}); });
......
...@@ -4,6 +4,7 @@ import android.app.NotificationManager; ...@@ -4,6 +4,7 @@ import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.TaskStackBuilder; import android.app.TaskStackBuilder;
import android.content.Intent; import android.content.Intent;
import android.support.v4.app.Fragment;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
import android.util.Log; import android.util.Log;
...@@ -68,15 +69,13 @@ public class NetServiceTablet implements iNetServiceDevice { ...@@ -68,15 +69,13 @@ public class NetServiceTablet implements iNetServiceDevice {
* the app. The most frequent reason is a password change while the user have been logged * the app. The most frequent reason is a password change while the user have been logged
* offline * offline
*/ */
public void restart_app() { public void restart_app(Intent serialActivity) {
StackTraceElement trace[] = Thread.currentThread().getStackTrace(); StackTraceElement trace[] = Thread.currentThread().getStackTrace();
Log.i(this.getClass().getCanonicalName(),"App restarted from "+trace[0]+"->"+trace[1]+"..."+ Log.i(this.getClass().getCanonicalName(),"App restarting");
trace[trace.length-2]+"->"+trace[trace.length-1]); if (serialActivity==null) serialActivity = new Intent(PCBcontext.getContext(), SerialActivity.class);
SerialActivity.resetDefaultUser();
Intent serialActivity = new Intent(PCBcontext.getContext(), SerialActivity.class);
serialActivity.putExtra("resetPrevUser", true); serialActivity.putExtra("resetPrevUser", true);
PCBcontext.getContext().startActivity(serialActivity); PCBcontext.getContext().startActivity(serialActivity);
} }
public void restart_app() {restart_app(null);}
} }
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/CIFlavor/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/CIFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/CIFlavor/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/CIFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/CIFlavor/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/CIFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/CIFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/CIFlavor/debug" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/CIFlavor/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/CIFlavor/debug" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/CIFlavor/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/CIFlavorDebug/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/CIFlavorDebug/res" type="java-resource" />
...@@ -54,6 +55,7 @@ ...@@ -54,6 +55,7 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/CIFlavor/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/CIFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/CIFlavor/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/CIFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/CIFlavor/debug" isTestSource="true" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/CIFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/CIFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/CIFlavor/debug" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/CIFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/CIFlavor/debug" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/CIFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/CIFlavor/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/CIFlavor/res" type="java-resource" />
...@@ -122,38 +124,30 @@ ...@@ -122,38 +124,30 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-ui/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-ui/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-utils/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-utils/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-fragment/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-fragment/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-media-compat/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-media-compat/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads-lite/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-auth-base/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-auth/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-clearcut/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gass/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-iid/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-tasks/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.koushikdutta.async/androidasync/2.1.9/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.koushikdutta.ion/ion/2.1.9/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
...@@ -163,41 +157,42 @@ ...@@ -163,41 +157,42 @@
</content> </content>
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-annotations-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-24.2.1" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-fragment-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="support-compat-24.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-24.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" /> <orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-fragment-24.2.0" level="project" /> <orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-24.2.0" level="project" /> <orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" /> <orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-24.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" /> <orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-24.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-24.2.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-24.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" />
<orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-24.2.0" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-24.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -47,8 +47,8 @@ public class MainActivity extends Activity { ...@@ -47,8 +47,8 @@ public class MainActivity extends Activity {
} }
private void login() { private void login() {
final String username="faf0001"; final String username="faf0002";
final String password="faf0001"; final String password="faf0002";
new UserLogin().login(username,password,this, MainActivity.class,null); new UserLogin().login(username,password,this, MainActivity.class,null);
} }
} }
...@@ -43,13 +43,17 @@ public class NetServiceWatch implements iNetServiceDevice { ...@@ -43,13 +43,17 @@ public class NetServiceWatch implements iNetServiceDevice {
* offline * offline
*/ */
public void restart_app() { public void restart_app() {
Intent intent= new Intent(PCBcontext.getContext(), Activity); restart_app(new Intent(PCBcontext.getContext(), Activity));
intent.putExtra("resetPrevUser", true); }
PCBcontext.getContext().startActivity(intent);
@Override
public void restart_app(Intent intent) {
intent.putExtra("resetPrevUser", true);
PCBcontext.getContext().startActivity(intent);
} }
public void set_notifyTextView(TextView _notifyTextView) { public void set_notifyTextView(TextView _notifyTextView) {
this.status = _notifyTextView; this.status = _notifyTextView;
} }
} }
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/DefaultFlavor/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/DefaultFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/DefaultFlavor/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/DefaultFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/DefaultFlavor/debug" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/DefaultFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/DefaultFlavor/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/DefaultFlavor/debug" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/DefaultFlavor/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/DefaultFlavor/debug" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/DefaultFlavor/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/res" type="java-resource" />
...@@ -42,6 +43,13 @@ ...@@ -42,6 +43,13 @@
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/jni" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavorDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/resources" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/assets" type="java-test-resource" />
...@@ -50,12 +58,6 @@ ...@@ -50,12 +58,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavorDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/DefaultFlavor/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DefaultFlavor/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/assets" type="java-resource" />
...@@ -122,32 +124,28 @@ ...@@ -122,32 +124,28 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads-lite/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-auth-base/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-auth/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/9.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-clearcut/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gass/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-iid/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-tasks/9.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-tasks/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/2.0.0-alpha2/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/2.0.0-alpha2/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
...@@ -158,35 +156,36 @@ ...@@ -158,35 +156,36 @@
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="wearable-2.0.0-alpha2" level="project" /> <orderEntry type="library" exported="" name="wearable-2.0.0-alpha2" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" /> <orderEntry type="library" exported="" name="play-services-wearable-9.2.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" /> <orderEntry type="library" exported="" name="androidasync-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-clearcut-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-wearable-9.2.1" level="project" /> <orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" /> <orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" /> <orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-gcm-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-auth-base-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-gass-9.2.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" /> <orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-iid-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.2.1" level="project" />
<orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" /> <orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-auth-9.2.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="support-v4-23.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" /> <orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
...@@ -89,7 +89,9 @@ thisTrigger: BEGIN ...@@ -89,7 +89,9 @@ thisTrigger: BEGIN
NOW(3) NOW(3)
) )
ON DUPLICATE KEY UPDATE id_stu=idstu, id_sup=idsup, id_ws=NEW.id_ws, id_opentry=NEW.id; ON DUPLICATE KEY UPDATE id_stu=idstu, id_sup=idsup, id_ws=NEW.id_ws, id_opentry=NEW.id;
END;; END;;
-- --
-- It deletes current try for a given session -- It deletes current try for a given session
DROP PROCEDURE IF EXISTS deleteOpenTry; DROP PROCEDURE IF EXISTS deleteOpenTry;
...@@ -117,6 +119,7 @@ AFTER INSERT ON working_session ...@@ -117,6 +119,7 @@ AFTER INSERT ON working_session
FOR EACH ROW FOR EACH ROW
thisTrigger: BEGIN thisTrigger: BEGIN
DECLARE idstu INT; DECLARE idstu INT;
DECLARE ins_begin DATE;
IF ((@TRIGGER_CHECKS = FALSE) IF ((@TRIGGER_CHECKS = FALSE)
OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE)) OR (@TRIGGER_AFTER_INSERT_CHECKS = FALSE))
...@@ -125,9 +128,25 @@ thisTrigger: BEGIN ...@@ -125,9 +128,25 @@ thisTrigger: BEGIN
LEAVE thisTrigger; LEAVE thisTrigger;
END IF; END IF;
UPDATE instruction SELECT begin INTO ins_begin
SET status='started' FROM instruction
WHERE id=new.id_ins; WHERE id = NEW.id_ins;
IF (ins_begin IS NULL) THEN
UPDATE instruction
SET
begin = NOW(3),
end = NOW(3)
WHERE
id = NEW.id_ins;
END IF;
UPDATE instruction
SET
status='started',
end = NOW(3)
WHERE
id = NEW.id_ins;
INSERT INTO try(`id_ws`) INSERT INTO try(`id_ws`)
VALUES (new.id); VALUES (new.id);
...@@ -150,6 +169,16 @@ thisTrigger: BEGIN ...@@ -150,6 +169,16 @@ thisTrigger: BEGIN
LEAVE thisTrigger; LEAVE thisTrigger;
END IF; END IF;
-- end date for related instruction is updated
IF (OLD.end < NEW.end) THEN
UPDATE instruction
SET
end = NEW.end
WHERE
id = NEW.id_ins;
END IF;
-- remove open try
IF ((old.end IS NULL) and (new.end IS NOT NULL)) THEN IF ((old.end IS NULL) and (new.end IS NOT NULL)) THEN
CALL deleteOpenTry(new.id); CALL deleteOpenTry(new.id);
END IF; END IF;
...@@ -335,6 +364,8 @@ thisTrigger: BEGIN ...@@ -335,6 +364,8 @@ thisTrigger: BEGIN
WHERE id = NEW.id_ws; WHERE id = NEW.id_ws;
END IF; END IF;
END;; END;;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"ngtoast": "~1.5.4", "ngtoast": "~1.5.4",
"angular-animate": "~1.4.1", "angular-animate": "~1.4.1",
"angular-sanitize": "~1.4.1", "angular-sanitize": "~1.4.1",
"angular-chart.js": "~0.7.2", "angular-chart.js": "latest",
"ng-lodash": "~0.3.0" "ng-lodash": "~0.3.0"
}, },
"resolutions": { "resolutions": {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
"alert": "Alert", "alert": "Alert",
"all": "All", "all": "All",
"animation": "Animation", "animation": "Animation",
"annual": "Annual",
"April": "April", "April": "April",
"attributes_not_updated": "Changes not saved", "attributes_not_updated": "Changes not saved",
"attributes_updated": "Changes saved", "attributes_updated": "Changes saved",
...@@ -102,6 +103,7 @@ ...@@ -102,6 +103,7 @@
"general_labels": "General labels", "general_labels": "General labels",
"generate": "Generate", "generate": "Generate",
"generate_serial": "Generate serial number", "generate_serial": "Generate serial number",
"global":"Global",
"hide": "Hide", "hide": "Hide",
"highlight": "highlight", "highlight": "highlight",
"highlighted": "Highlighted", "highlighted": "Highlighted",
...@@ -142,6 +144,7 @@ ...@@ -142,6 +144,7 @@
"methods": "Methods", "methods": "Methods",
"minutes": "minutes", "minutes": "minutes",
"month_totals": "Month totals", "month_totals": "Month totals",
"monthly":"Monthly",
"name": "Name", "name": "Name",
"new_instruction": "New instruction", "new_instruction": "New instruction",
"new_method": "New method", "new_method": "New method",
...@@ -269,10 +272,12 @@ ...@@ -269,10 +272,12 @@
"tag_deleted": "Tag deleted", "tag_deleted": "Tag deleted",
"tape_background": "Tape background", "tape_background": "Tape background",
"template_deleted": "Template deleted", "template_deleted": "Template deleted",
"time_instruction_method": "Time instructions of method",
"time_hours": "Time: {{hours}} hours", "time_hours": "Time: {{hours}} hours",
"time_instruction_method": "Time instructions of method",
"time_sessions_total": "Total sessions time",
"time_sessions_per_days": "Time of sessions per days in", "time_sessions_per_days": "Time of sessions per days in",
"time_sessions_per_month": "Time of sessions per months in", "time_sessions_per_month": "Time of sessions per months in",
"time_tries_total": "Total tries time",
"time_tries_per_days": "Time of tries per days in", "time_tries_per_days": "Time of tries per days in",
"time_tries_per_month": "Time of tries per months in", "time_tries_per_month": "Time of tries per months in",
"title": "Title", "title": "Title",
...@@ -281,6 +286,7 @@ ...@@ -281,6 +286,7 @@
"tpl_day": "{{ day | date:'yyyy-MM-dd' }}", "tpl_day": "{{ day | date:'yyyy-MM-dd' }}",
"tpl_hours_frame": "from {{ begin | date:'HH:mm:ss' }} to {{ end | date:'HH:mm:ss' }}", "tpl_hours_frame": "from {{ begin | date:'HH:mm:ss' }} to {{ end | date:'HH:mm:ss' }}",
"tries": "Tries", "tries": "Tries",
"tries_done": "Tries done",
"tries_length": "Tries length", "tries_length": "Tries length",
"tries_mean_length": "Tries mean length", "tries_mean_length": "Tries mean length",
"tries_per_days": "Tries per days in", "tries_per_days": "Tries per days in",
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
"alert": "Alerta", "alert": "Alerta",
"all": "Todos", "all": "Todos",
"animation": "Animación", "animation": "Animación",
"annual": "Anual",
"April": "Abril", "April": "Abril",
"attributes_not_updated": "Cambios no guardados", "attributes_not_updated": "Cambios no guardados",
"attributes_updated": "Cambios guardados", "attributes_updated": "Cambios guardados",
...@@ -102,6 +103,7 @@ ...@@ -102,6 +103,7 @@
"general_labels": "Generales", "general_labels": "Generales",
"generate": "Generar", "generate": "Generar",
"generate_serial": "Generar número de serie", "generate_serial": "Generar número de serie",
"global":"Global",
"hide": "Ocultar", "hide": "Ocultar",
"highlight": "Resaltar", "highlight": "Resaltar",
"highlighted": "Resaltado", "highlighted": "Resaltado",
...@@ -142,6 +144,7 @@ ...@@ -142,6 +144,7 @@
"methods": "Métodos", "methods": "Métodos",
"minutes": "minutos", "minutes": "minutos",
"month_totals": "Totales mes", "month_totals": "Totales mes",
"monthly":"Mensual",
"name": "Nombre", "name": "Nombre",
"new_instruction": "Nueva instrucción", "new_instruction": "Nueva instrucción",
"new_method": "Nuevo método", "new_method": "Nuevo método",
...@@ -272,8 +275,10 @@ ...@@ -272,8 +275,10 @@
"template_deleted": "Plantilla eliminada", "template_deleted": "Plantilla eliminada",
"time_hours": "Tiempo: {{hours}} horas", "time_hours": "Tiempo: {{hours}} horas",
"time_instruction_method": "Tiempo instrucciones del método", "time_instruction_method": "Tiempo instrucciones del método",
"time_sessions_total": "Tiempo total de sesiones",
"time_sessions_per_days": "Tiempo de sesiones por días en", "time_sessions_per_days": "Tiempo de sesiones por días en",
"time_sessions_per_month": "Tiempo de sesiones por meses en", "time_sessions_per_month": "Tiempo de sesiones por meses en",
"time_tries_total": "Tiempo total de ensayos",
"time_tries_per_days": "Tiempo de ensayos por días en", "time_tries_per_days": "Tiempo de ensayos por días en",
"time_tries_per_month": "Tiempo de ensayos por meses en", "time_tries_per_month": "Tiempo de ensayos por meses en",
"title": "Título", "title": "Título",
...@@ -282,6 +287,7 @@ ...@@ -282,6 +287,7 @@
"tpl_day": "{{ day | date:'dd-MM-yyyy' }}", "tpl_day": "{{ day | date:'dd-MM-yyyy' }}",
"tpl_hours_frame": "de {{ begin | date:'HH:mm:ss' }} a {{ end | date:'HH:mm:ss' }}", "tpl_hours_frame": "de {{ begin | date:'HH:mm:ss' }} a {{ end | date:'HH:mm:ss' }}",
"tries": "Ensayos", "tries": "Ensayos",
"tries_done": "Ensayos realizados",
"tries_length": "Duración ensayos", "tries_length": "Duración ensayos",
"tries_mean_length": "Duración media ensayos", "tries_mean_length": "Duración media ensayos",
"tries_per_days": "Número de ensayos por días en", "tries_per_days": "Número de ensayos por días en",
......
...@@ -16,7 +16,7 @@ var dashboardApp = angular.module('dashboardApp', [ ...@@ -16,7 +16,7 @@ var dashboardApp = angular.module('dashboardApp', [
'ngAnimate', 'ngAnimate',
'ngSanitize', 'ngSanitize',
'ngToast', 'ngToast',
'chart.js', 'Chart.js',
'ngLodash' 'ngLodash'
]); ]);
......
...@@ -5,13 +5,18 @@ ...@@ -5,13 +5,18 @@
//----------------------- //-----------------------
dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtrl($scope, $stateParams, $http, config, $filter, $translate) { dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtrl($scope, $stateParams, $http, config, $filter, $translate) {
// --------------------------------------------------------------------------
//
// INICIALIZACIÓN DE VARIABLES
//
// For tab navigation (here too, if the user refresh the page...) // For tab navigation (here too, if the user refresh the page...)
$scope.nav.tab = 'reports'; $scope.nav.tab = 'reports';
// It it is the first time in a student section, there is not // It it is the first time in a student section, there is not
// charged the student info in the user object at parent scope // charged the student info in the user object at parent scope
if(!$scope.studentData.id){ if(!$scope.studentData.id){
$scope.studentData.id = $stateParams.idStudent; $scope.studentData.id = $stateParams.idStudent;
} }
// Date vars // Date vars
...@@ -22,551 +27,208 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr ...@@ -22,551 +27,208 @@ dashboardControllers.controller('StudentReportsCtrl', function StudentReportsCtr
// Array of years from 2015 to now (for testing, from 2013) // Array of years from 2015 to now (for testing, from 2013)
$scope.years = []; $scope.years = [];
for(var i=2013; i<=$scope.year; i++) $scope.years.push(i); for(var i=2013; i<=$scope.year; i++) $scope.years.push(i);
// Array of months transalated // Array of months transalated
$scope.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; $scope.months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
$translate($scope.months).then(function (translations) { $translate($scope.months).then(function (translations) {
// Convert translation format [{"January":"Enero"}, ...] to a simple array ["January", ...] // Convert translation format [{"January":"Enero"}, ...] to a simple array ["January", ...]
var trans = []; var trans = [];
for(var i=0; i<$scope.months.length; i++) trans.push(translations[$scope.months[i]]); for(var i=0; i<$scope.months.length; i++) trans.push(translations[$scope.months[i]]);
// Assign translated months to array and the actual month // Assign translated months to array and the actual month
$scope.months = trans; $scope.months = trans;
$scope.month = $scope.months[$scope.month_number]; $scope.month = $scope.months[$scope.month_number];
}); });
// Get all the working sessions of the student
$http
.get(config.backend+'/stu/'+ $scope.studentData.id +'/ws')
.success(function(data, status, headers, config) {
$scope.ws = data;
// Call function to build the charts and statistics
$scope.statistics_year();
})
.error(function(data, status, headers, config) {
console.log("Error from API: " + data.error);
});
// --------------------------------------------------------------------------
// //
// Build the charts and statistics of a year // OBTENCIÓN DE LOS DATOS
// //
$scope.statistics_year = function(){
var data = $scope.ws;
/////
///// Prepare the data structures
/////
// Count of WS in every month of a year
var totals_ws_year = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
// Time of WS in every month of a year
var times_ws_year = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
// Count of WS in every day of a month
// 2Dim Array of days of months, for labels (1, 2, 3, 4... 28, 29, 30)
$scope.days = [];
// 2Dim Array of totals and times in months
$scope.totals_ws_month=[], $scope.times_ws_month=[];
// Loop over the 12 months of the year
for(var i=0; i<12; i++){
// Local vars for actual month
var totals_ws_act_month=[], times_ws_act_month=[];
var days_act_month = [];
// Loop over the days of the actual month to initialize to 0 all days
var lastDayOfMonth = new Date($scope.year, i+1, 0).getDate();
for(var j=1; j<=lastDayOfMonth; j++){
totals_ws_act_month.push(0); // Number count initialitation
times_ws_act_month.push(0); // Time count initialitation
days_act_month.push(j); // Day label (1, 2, 3, 4, 5 ... 30)
}
// Assign the actual month array to the global 2Dim array
$scope.days.push(days_act_month);
$scope.totals_ws_month.push(totals_ws_act_month);
$scope.times_ws_month.push(times_ws_act_month);
}
///// End the preparation or data structures
/////
///// Fill data structures looping on data
/////
// Date vars and global time counter
var date, date_end, ws_year, ws_month, ws_day, ws_milliseconds, diffDates;
$scope.ws_total_time = 0;
// Loop over every ws of the student
for(var i=0; i<data.length; i++) {
// Convert json string to date object of every ws
date = new Date(data[i].begin);
date_end = new Date(data[i].end);
// Initializing date vars
ws_year = date.getFullYear();
ws_month = date.getMonth();
ws_day = date.getDate()-1; // getDate returns the day of the month from 1 to 31
// Difference of milliseconds converted to hours, checking if the difference
// is positive to prevent one date is null and therefore it has a 1970s date value
ws_milliseconds = date_end - date;
diffDates = (ws_milliseconds > 0) ? (ws_milliseconds / (1000 * 60 * 60)) : 0;
// Increase total time counter
$scope.ws_total_time += diffDates;
// Statistics for the selected year
if(ws_year == $scope.year){
// Number/Time sessions per month (Not necessary to go in the scope because it is calculated every time this function is executed)
totals_ws_year[ws_month]++;
times_ws_year[ws_month] += diffDates;
// Number/Time sessions per day for every month
$scope.totals_ws_month[ws_month][ws_day]++;
$scope.times_ws_month[ws_month][ws_day] += diffDates;
}
}
///// End of filling data structures
/////
///// Calculate statistics
/////
// First and last day of sessions
var first_ws_date = new Date(data[0].begin);
var last_ws_date = new Date(data[data.length-1].begin); // begin date because this session could not be finished yet
// Total, time, days from beginning and average time of sessions
$scope.ws_total = data.length;
$scope.ws_total_time = $scope.ws_total_time.toFixed(2);
$scope.total_ws_days = Math.ceil((last_ws_date - first_ws_date) / (1000 * 60 * 60 * 24));
$scope.session_hours = ($scope.ws_total_time / $scope.ws_total).toFixed(2);
// Note: The reduce() method applies a function against an accumulator and
// each value of the array (from left-to-right) has to reduce it to a single value.
// Syntax: arr.reduce(callback[, initialValue])
// Sum, time and avg of sessions in the actual year
$scope.total_ws_year = totals_ws_year.reduce(function(pv, cv) { return pv + cv; }, 0);
$scope.time_ws_year = (times_ws_year.reduce(function(pv, cv) { return pv + cv; }, 0)).toFixed(2);
$scope.avg_ws_year = ($scope.time_ws_year / $scope.total_ws_year).toFixed(2);
// Sum, time and avg of sessions in the actual month
$scope.total_ws_month = $scope.totals_ws_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0);
$scope.time_ws_month = ($scope.times_ws_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0)).toFixed(2);
$scope.avg_ws_month = ($scope.time_ws_month / $scope.total_ws_month).toFixed(2);
///// End of calculating statistics
/////
///// Build charts
/////
// Chart 1: Number of sessions per month
$scope.labels1 = $scope.months;
$scope.series1 = ['sessions'];
$scope.data1 = [totals_ws_year];
// It recieves the nearest points to the click area
$scope.onClick1 = function (points, evt) {
$scope.change_month(points[0].label);
};
// Chart 2: Number of sessions per day
$scope.labels2 = $scope.days[$scope.month_number];
$scope.series2 = ['sessions'];
$scope.data2 = [$scope.totals_ws_month[$scope.month_number]];
// Chart 3: Time of sessions per month
$scope.labels3 = $scope.months;
$scope.series3 = ['hours'];
$scope.data3 = [times_ws_year];
// It recieves the nearest points to the click area
$scope.onClick3 = function (points, evt) {
$scope.change_month(points[0].label);
};
// Chart 4: Time of sessions per day
$scope.labels4 = $scope.days[$scope.month_number];
$scope.series4 = ['hours'];
$scope.data4 = [$scope.times_ws_month[$scope.month_number]];
///// End of build charts
};
//
// Change the actual month in statistics and charts (passed the name of month
// instead the number because the name is returned clicking on year charts)
//
$scope.change_month = function(nameOfMonth){
$scope.month_number = $scope.months.indexOf(nameOfMonth);
$scope.month = $scope.months[$scope.month_number];
// Totals
$scope.total_ws_month = $scope.totals_ws_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0);
$scope.time_ws_month = ($scope.times_ws_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0)).toFixed(2);
$scope.avg_ws_month = ($scope.time_ws_month / $scope.total_ws_month).toFixed(2);
// Chart 2
$scope.labels2 = $scope.days[$scope.month_number];
$scope.data2 = [$scope.totals_ws_month[$scope.month_number]];
// Chart 4
$scope.labels4 = $scope.days[$scope.month_number];
$scope.data4 = [$scope.times_ws_month[$scope.month_number]];
};
//
// Charts for methods / instructions / tries
//
// Initializing array of methods
$scope.reportsMethods = [];
// Statistics vars
$scope.instructions_total = 0;
$scope.tries_total = 0;
$scope.tries_total_time = 0;
// Get all the tries of the student // Get all the tries of the student
$http $http
.get(config.backend+'/stu/'+ $scope.studentData.id +'/tries') .get(config.backend+'/stu/'+ $scope.studentData.id +'/tries')
.success(function(data, status, headers, config) { .success(function(data, status, headers, config) {
$scope.fulldata = data;
// Call function to build the charts and statistics // Call function to build the charts and statistics
// Loop methods $scope.statistics();
for(var i=0; i<data.length; i++){
console.log("METHOD " + i + " " + data[i].name);
var instructions = data[i].instructions;
// Totals and Tries time
data[i].tries_total = 0;
data[i].tries_time = 0;
// Loop instructions
for(var j=0; j<instructions.length; j++){
console.log("-- Instruction " + j + ": " + instructions[j].name);
var tries = instructions[j].tries;
$scope.instructions_total++;
// Total tries for a method
data[i].tries_total += data[i].instructions[j].tries.length;
// Tries time
data[i].instructions[j].tries_time = 0;
// Result of tries
data[i].instructions[j].tries_success = 0;
data[i].instructions[j].tries_supsuccess = 0;
data[i].instructions[j].tries_sposuccess = 0;
data[i].instructions[j].tries_fail = 0;
data[i].instructions[j].tries_discarded = 0;
data[i].instructions[j].tries_model = 0;
data[i].instructions[j].tries_broken = 0;
// Loop tries
for(var k=0; k<tries.length; k++){
// Convert dates from string to Date objects
var begin = new Date(tries[k].begin);
var end = new Date(tries[k].end);
data[i].instructions[j].tries[k].begin = begin;
data[i].instructions[j].tries[k].end = end;
var seconds = (end - begin) / 1000;
// Time for all tries/instructions/method
$scope.tries_total_time += seconds;
data[i].instructions[j].tries_time += seconds;
data[i].tries_time += seconds;
$scope.tries_total++;
console.log("---- Try " + k + ":" + tries[k].result + " - "+ seconds +" (" + begin + " - " + end + ")");
switch(data[i].instructions[j].tries[k].result){
case 'SUCCESS':
data[i].instructions[j].tries_success++;
break;
case 'SUPERVISED SUCCESS':
data[i].instructions[j].tries_supsuccess++;
break;
case 'SPONTANEOUS SUCCESS':
data[i].instructions[j].tries_sposuccess++;
break;
case 'FAIL':
data[i].instructions[j].tries_fail++;
break;
case 'DISCARDED':
data[i].instructions[j].tries_discarded++;
break;
case 'MODEL':
data[i].instructions[j].tries_model++;
break;
case 'BROKEN':
default:
data[i].instructions[j].tries_broken++;
}
}
console.log("SUCCESS: " + data[i].instructions[j].tries_success
+ " | SUP SUCCESS: " + data[i].instructions[j].tries_supsuccess
+ " | SUP SUCCESS: " + data[i].instructions[j].tries_supsuccess
+ " | SPO SUCCESS: " + data[i].instructions[j].tries_sposuccess
+ " | FAIL: " + data[i].instructions[j].tries_fail
+ " | DISCARDED: " + data[i].instructions[j].tries_discarded
+ " | MODEL: " + data[i].instructions[j].tries_model
+ " | BROKEN: " + data[i].instructions[j].tries_broken);
}
// End of looping instructions
}
// End of looping methods
$scope.reportsMethods = data;
$scope.selectedMethod = $scope.reportsMethods[0]; // The default method is the first of the array
$scope.selectedIns = $scope.reportsMethods[0].instructions[0]; // And the first instruction
// Charts of selectedMethod
$scope.instructions_charts();
var date = new Date("2015-07-14");
var successTries = $filter('filter')($scope.methods[0].instructions[0].tries, { begin : { "<=" : date } });
console.log("-------------------------->" + JSON.stringify(successTries));
}) })
.error(function(data, status, headers, config) { .error(function(data, status, headers, config) {
console.log("Error from API: " + data.error); console.log("Error from API: " + data.error);
}); });
//Statistics generation
$scope.statistics = function(){
//Full tries data list
// Chart 6: Time of sessions per day var data = $scope.fulldata;
$scope.labels6 = ['SUCCESS','SUPERVISED SUCCESS','SPONTANEOUS SUCCESS','FAIL', 'DISCARDED', 'MODEL', 'BROKEN'];
$scope.series6 = ['tries']; /* -----------------------------------------------------------------------
//$scope.data6 = [$scope.times_ws_month[$scope.month_number]]; "methods->instructions->working_sessions->tries"
// Here outside the function the definition immediately, - Para cada nodo de la estructura anterior pueden existir mas de una ocurrencia
// then "populating" it as the async callback runs. - Se crean acumuladores para obtener los datos con el menor numero de iteraciones
$scope.labels7_8 = []; - Las estadisticas se muestran como : GENERAL - ANUAL - MENSUAL, por lo que
$scope.data7 = []; los recorridos que se especifican a continuacion se pueden reutilizar para
$scope.data8 = []; cualquiera de los 3 casos, simplemente hay que cambiar la lista de datos que
se le pasa. Referencia: $scope.fulldata
$scope.instructions_charts = function(){ ----------------------------------------------------------------------- */
// Chart 7 & 8: Number & Time of tries per instruction //Accumulators array
var v_ins = $scope.selectedMethod.instructions; //[0] is for GENERAL
// Empty data arrays for new elements when a method is selected //[1] is for CURRENT YEAR
$scope.labels7_8 = []; //[2] is for CURRENT MONTH
$scope.data7 = []; var ws_number = [0,0,0];
$scope.data8 = []; var ws_time = [0,0,0];
var tries_number = [0,0,0];
for(var i=0; i<v_ins.length; i++){ var tries_time = [0,0,0];
$scope.labels7_8.push(v_ins[i].name);
$scope.data7.push(v_ins[i].tries.length); //*** Charts arrays ***
$scope.data8.push((v_ins[i].tries_time/60).toFixed(2));
} //ws counter month by month
$scope.series7 = ['tries']; var ws_number_array_month = [0,0,0,0,0,0,0,0,0,0,0,0]; //ws number every month
$scope.series8 = ['minutes']; var ws_time_array_month = [0,0,0,0,0,0,0,0,0,0,0,0]; //ws time every month
}; var pictos_number_array_month = [0,0,0,0,0,0,0,0,0,0,0,0]; //pictos number every month
// //ws counter day by day this month
// Build the tries charts and statistics of a year var daysThisMonth = []; //array with this month length
// var ws_number_array_dayThisMonth = []; //ws number every day this month
var pictos_number_array_dayThismonth = []; //number of pictos every day this month
// OJO: MODIFICAR FUNCIÓN PARA HACER GENÉRICA Y QUE COJA TODOS LOS TRIES DE //Inicialization
// LA INSTRUCCIÓN ( TAL Y COMO ESTÁ ), TODOS LOS DEL MÉTODO O TODOS LOS DEL for(var i=0;i<new Date(new Date().getFullYear(), new Date().getMonth()+1, 0).getDate();i++){
// ALUMNO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! daysThisMonth[i]=0;
$scope.tries_charts_year = function(){ ws_number_array_dayThisMonth[i]=0;
pictos_number_array_dayThismonth[i]=0;
var tries = $scope.selectedIns.tries;
/////
///// Prepare the data structures
/////
// Count of total tries in every month of a year
var totals_tries_year = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
// Count of every type of tries in every month of a year
var total_tries_success = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var total_tries_supsuccess = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var total_tries_sposuccess = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var total_tries_fail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var total_tries_discarded = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var total_tries_model = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var total_tries_broken = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
// Time of total tries in every month of a year
var times_tries_year = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
// Count of every type of tries in every month of a year
var time_tries_success = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var time_tries_supsuccess = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var time_tries_sposuccess = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var time_tries_fail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var time_tries_discarded = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var time_tries_model = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
var time_tries_broken = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
// Count of tries in every day of a month
// 2Dim Array of days of months, for labels (1, 2, 3, 4... 28, 29, 30)
$scope.days_tries = [];
// 2Dim Array of totals and times in months
$scope.totals_tries_month=[], $scope.times_tries_month=[];
// Loop over the 12 months of the year
for(var i=0; i<12; i++){
// Local vars for actual month
var totals_tries_act_month=[], times_tries_act_month=[];
var days_tries_act_month = [];
// Loop over the days of the actual month to initialize to 0 all days
var lastDayOfMonth = new Date($scope.year, i+1, 0).getDate();
for(var j=1; j<=lastDayOfMonth; j++){
totals_tries_act_month.push(0); // Number count initialitation
times_tries_act_month.push(0); // Time count initialitation
days_tries_act_month.push(j); // Day label (1, 2, 3, 4, 5 ... 30)
}
// Assign the actual month array to the global 2Dim array
$scope.days_tries.push(days_tries_act_month);
$scope.totals_tries_month.push(totals_tries_act_month);
$scope.times_tries_month.push(times_tries_act_month);
}
///// End the preparation or data structures
/////
///// Fill data structures looping on data
/////
// Date vars and global time counter
var date, date_end, try_year, try_month, try_day, try_milliseconds, diffDates;
$scope.try_total_time = 0;
// Loop over every ws of the student
for(var i=0; i<tries.length; i++) {
// Convert json string to date object of every ws
date = new Date(tries[i].begin);
date_end = new Date(tries[i].end);
// Initializing date vars
try_year = date.getFullYear();
try_month = date.getMonth();
try_day = date.getDate()-1; // getDate returns the day of the month from 1 to 31
// Difference of milliseconds converted to hours, checking if the difference
// is positive to prevent one date is null and therefore it has a 1970s date value
try_milliseconds = date_end - date;
diffDates = (try_milliseconds > 0) ? (try_milliseconds / (1000 * 60 * 60)) : 0;
// Increase total time counter
$scope.try_total_time += diffDates;
// Statistics for the selected year
if(try_year == $scope.year){
// Number/Time tries per month (Not necessary to go in the scope because it is calculated every time this function is executed)
totals_tries_year[try_month]++;
times_tries_year[try_month] += diffDates;
// Number/Time tries per day for every month
$scope.totals_tries_month[try_month][try_day]++;
$scope.times_tries_month[try_month][try_day] += diffDates;
}
} }
///// End of filling data structures //***** METHODS LOOP
for(var i=0;i<data.methods.length;i++){
///// //***** INSTRUCTIONS LOOP
///// Calculate statistics for(var j=0;j<data.methods[i].instructions.length;j++){
/////
//***** WORKING_SESSIONS LOOP
// First and last day of sessions for(var k=0;k<data.methods[i].instructions[j].working_sessions.length;k++){
var first_try_date = new Date(tries[0].begin); //working_sessions GENERAL
var last_try_date = new Date(tries[tries.length-1].begin); // begin date because this try could not be finished yet ws_number[0]++;
ws_time[0] += (new Date(data.methods[i].instructions[j].working_sessions[k].end).getTime() - new Date(data.methods[i].instructions[j].working_sessions[k].begin).getTime());
// Total, time, days from beginning and average time of tries
$scope.try_total = tries.length; //working_sessions this YEAR
$scope.try_total_time = $scope.try_total_time.toFixed(2); if(new Date(data.methods[i].instructions[j].working_sessions[k].end).getYear() == new Date().getYear()){
$scope.total_tries_days = Math.ceil((last_try_date - first_try_date) / (1000 * 60 * 60 * 24)); ws_number[1]++;
$scope.tries_hours = ($scope.try_total_time / $scope.try_total).toFixed(2); ws_time[1] += (new Date(data.methods[i].instructions[j].working_sessions[k].end).getTime() - new Date(data.methods[i].instructions[j].working_sessions[k].begin).getTime());
}
// Note: The reduce() method applies a function against an accumulator and
// each value of the array (from left-to-right) has to reduce it to a single value. //working_sessions this MONTH
// Syntax: arr.reduce(callback[, initialValue]) if(new Date(data.methods[i].instructions[j].working_sessions[k].end).getYear() == new Date().getYear() && new Date(data.methods[i].instructions[j].working_sessions[k].end).getMonth() == new Date().getMonth()){
ws_number[2]++;
// Sum, time and avg of tries in the actual year ws_time[2] += (new Date(data.methods[i].instructions[j].working_sessions[k].end).getTime() - new Date(data.methods[i].instructions[j].working_sessions[k].begin).getTime());
$scope.total_tries_year = totals_tries_year.reduce(function(pv, cv) { return pv + cv; }, 0); }
$scope.time_tries_year = (times_tries_year.reduce(function(pv, cv) { return pv + cv; }, 0)).toFixed(2);
$scope.avg_tries_year = ($scope.time_tries_year / $scope.total_tries_year).toFixed(2); //working_sessions EVERY MONTH, THIS YEAR
if(new Date(data.methods[i].instructions[j].working_sessions[k].end).getYear() == new Date().getYear()){
// Sum, time and avg of tries in the actual month ws_number_array_month[new Date(data.methods[i].instructions[j].working_sessions[k].end).getMonth()]++;
$scope.total_tries_month = $scope.totals_tries_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0); ws_time_array_month[new Date(data.methods[i].instructions[j].working_sessions[k].end).getMonth()] += (new Date(data.methods[i].instructions[j].working_sessions[k].end).getTime() - new Date(data.methods[i].instructions[j].working_sessions[k].begin).getTime()) / (1000 * 3600);
$scope.time_tries_month = ($scope.times_tries_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0)).toFixed(2); }
$scope.avg_tries_month = ($scope.time_tries_month / $scope.total_tries_month).toFixed(2);
//working_sessions EVERY DAY, THIS MONTH
///// End of calculating statistics if(new Date(data.methods[i].instructions[j].working_sessions[k].end).getYear() == new Date().getYear() && new Date(data.methods[i].instructions[j].working_sessions[k].end).getMonth() == new Date().getMonth()){
ws_number_array_dayThisMonth[new Date(data.methods[i].instructions[j].working_sessions[k].end).getDate()]++;
///// }
///// Build charts
///// //***** TRIES LOOP
for(var l=0;l<data.methods[i].instructions[j].working_sessions[k].tries.length;l++){
// Chart 9: Number of tries per month
$scope.labels9 = $scope.months; //tries GENERAL
$scope.series9 = ['tries']; tries_number[0]++;
$scope.data9 = [totals_tries_year]; if(data.methods[i].instructions[j].working_sessions[k].tries[l].end != null){ //discard tries with end==null
// It recieves the nearest points to the click area //hours of tries general
$scope.onClick9 = function (points, evt) { tries_time[0] += (new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].end).getTime() - new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getTime());
$scope.change_month_tries(points[0].label); }
};
//tries YEAR
// Chart 10: Number of tries per day if(new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getYear() == new Date().getYear()){
$scope.labels10 = $scope.days_tries[$scope.month_number]; tries_number[1]++;
$scope.series10 = ['tries']; if(data.methods[i].instructions[j].working_sessions[k].tries[l].end != null){ //discard tries with end==null
$scope.data10 = [$scope.totals_tries_month[$scope.month_number]]; //hours of tries general
tries_time[1] += (new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].end).getTime() - new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getTime());
// Chart 11: Time of tries per month }
$scope.labels11 = $scope.months; }
$scope.series11 = ['hours'];
$scope.data11 = [times_tries_year]; //tries MONTH
// It recieves the nearest points to the click area if(new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getYear() == new Date().getYear() && new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getMonth() == new Date().getMonth()){
$scope.onClick11 = function (points, evt) { tries_number[2]++;
$scope.change_month_tries(points[0].label); if(data.methods[i].instructions[j].working_sessions[k].tries[l].end != null){ //discard tries with end==null
}; //hours of tries general
tries_time[2] += (new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].end).getTime() - new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getTime());
// Chart 12: Time of tries per day }
$scope.labels12 = $scope.days_tries[$scope.month_number]; }
$scope.series12 = ['hours'];
$scope.data12 = [$scope.times_tries_month[$scope.month_number]]; //pictos EVERY MONTH, THIS YEAR
if(new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getYear() == new Date().getYear()){
///// End of build charts pictos_number_array_month[new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].end).getMonth()] += data.methods[i].instructions[j].working_sessions[k].tries[l].actions.length;
}; }
$scope.change_month_tries = function(nameOfMonth){
//pictos EVERY DAY, THIS MONTH
$scope.month_number = $scope.months.indexOf(nameOfMonth); if(new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getYear() == new Date().getYear() && new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].begin).getMonth() == new Date().getMonth()){
$scope.month = $scope.months[$scope.month_number]; pictos_number_array_dayThismonth[new Date(data.methods[i].instructions[j].working_sessions[k].tries[l].end).getDate()] += data.methods[i].instructions[j].working_sessions[k].tries[l].actions.length;
}
// Totals
$scope.total_tries_month = $scope.totals_tries_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0); }
$scope.time_tries_month = ($scope.times_tries_month[$scope.month_number].reduce(function(pv, cv) { return pv + cv; }, 0)).toFixed(2); // end of tries loop *****
$scope.avg_tries_month = ($scope.time_tries_month / $scope.total_tries_month).toFixed(2); }
// end of working_sessions loop *****
// Chart 10 }
$scope.labels10 = $scope.days_tries[$scope.month_number]; // end of instructions loop *****
$scope.data10 = [$scope.totals_tries_month[$scope.month_number]]; }
// end of methods loop *****
// Chart 12
$scope.labels12 = $scope.days_tries[$scope.month_number]; //TRANSLATE LANGUAGE
$scope.data12 = [$scope.times_tries_month[$scope.month_number]]; if ($translate.use() == 'es-es') $scope.user_language = 'es';
}; if ($translate.use() == 'en-gb') $scope.user_language = 'en';
/* //ws NUMBER
// Chart 1 $scope.ws_number = ws_number[0];
$scope.labels1 = ["January", "February", "March", "April", "May", "June", "July"]; $scope.ws_number_year = ws_number[1];
$scope.series1 = ['Series A', 'Series B', 'Series C']; $scope.ws_number_month = ws_number[2];
$scope.data1 = [
[65, 59, 80, 81, 56, 55, 40], //ws TIME
[28, 48, 40, 19, 86, 27, 90], $scope.ws_time = humanizeDuration(ws_time[0], { language: $scope.user_language, round: true });
[18, 43, 70, 29, 46, 57, 60] $scope.ws_time_year = humanizeDuration(ws_time[1], { language: $scope.user_language, round: true });
]; $scope.ws_time_month = humanizeDuration(ws_time[2], { language: $scope.user_language, round: true });
$scope.onClick1 = function (points, evt) {
console.log(points, evt); //tries NUMBER
}; $scope.tries_number = tries_number[0];
*/ $scope.tries_number_year = tries_number[1];
$scope.tries_number_month = tries_number[2];
}); //tries TIME
\ No newline at end of file $scope.tries_time = humanizeDuration(tries_time[0], { language: $scope.user_language, round: true });
$scope.tries_time_year = humanizeDuration(tries_time[1], { language: $scope.user_language, round: true });
$scope.tries_time_month = humanizeDuration(tries_time[2], { language: $scope.user_language, round: true });
//CHART DATA TEST
//*** Year Chart ***
$scope.labels2 = $scope.months;
$scope.series2 = ['Sesiones','Pictogramas','Horas'];
$scope.dataChart2 = [
ws_number_array_month,
pictos_number_array_month,
ws_time_array_month,
];
//*** Month Chart ***
var daysMonth = [];
for(var i=0;i<daysThisMonth.length;i++){
daysMonth[i] = i+1;
}
$scope.labels3 = daysMonth;
$scope.series3 = ['Sesiones','Pictogramas','Horas'];
$scope.dataChart3 = [
ws_number_array_dayThisMonth,
pictos_number_array_dayThismonth
];
};
});
<div> <div>
<div class="modal-header"> <div class="modal-header">
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-default" ng-model="source" uib-btn-radio="'symbolstx'" ng-click="open_category_from_bc('0')">Symbolstx</button> <button class="btn btn-default" ng-model="source" uib-btn-radio="'symbolstx'" ng-click="open_category_from_bc('0')">SymbolStix</button>
<button class="btn btn-default" ng-model="source" uib-btn-radio="'ownpictos'" ng-click="load_own_pictos()" translate>own_pictos</button> <button class="btn btn-default" ng-model="source" uib-btn-radio="'ownpictos'" ng-click="load_own_pictos()" translate>own_pictos</button>
</div> </div>
</div> </div>
......
<!-- Reports tab--> <!-- Reports tab-->
<div class="panel panel-default student_tab_panel"> <div class="panel panel-default student_tab_panel">
<div class="panel-body"> <div class="panel-body">
<div class="row">
<div class="col-md-12">
<h3 translate>sessions</h3>
</div>
</div>
<div class="row">
<div class="col-md-4">
<p>{{ 'totals' | translate }}:</p>
<ul>
<li>{{ 'sessions' | translate }}: {{ ws_total }}</li>
<li>{{ 'time_hours' | translate:{'hours': ws_total_time} }}</li>
<li>{{ 'days' | translate}}: {{ total_ws_days }} {{ 'days_from_first_session' | translate }}</li>
<li>{{ 'session_mean_length' | translate:{'hours': session_hours} }}</li>
</ul>
</div>
<div class="col-md-4">
<p translate>year_totals
<select id="year_select" ng-model="year" ng-options="y as y for y in years" ng-change="statistics_year()"></select>
</p>
<ul>
<li>{{ 'sessions' | translate }}: {{ total_ws_year }}</li>
<li>{{ 'time_hours' | translate:{'hours': time_ws_year} }}</li>
<li>{{ 'session_mean_length' | translate:{'hours': avg_ws_year} }}</li>
</ul>
</div>
<div class="col-md-4">
<p translate>month_totals
<select id="month_select" ng-model="month" ng-options="m as m for m in months" ng-change="change_month(month)"></select>
</p>
<ul>
<li>{{ 'sessions' | translate }}: {{ total_ws_month }}</li>
<li>{{ 'time_hours' | translate:{'hours': time_ws_month} }}</li>
<li>{{ 'session_mean_length' | translate:{'hours': avg_ws_month} }}</li>
</ul>
</div>
</div>
<div class="row">
<!-- Number of sessions per month -->
<div class="col-md-6">
<h4>{{ 'num_sessions_per_month_in' | translate }} {{ year }}</h4>
<canvas class="chart chart-bar" data="data1"
labels="labels1" legend="true" series="series1" click="onClick1">
</canvas>
</div>
<!-- Number of sessions per day -->
<div class="col-md-6">
<h4>{{ 'num_sessions_per_day_in' | translate}} {{ months[month_number] | translate }}</h4>
<canvas class="chart chart-line"
data="data2" labels="labels2" legend="true" series="series2">
</canvas>
</div>
<!-- Time of sessions per month -->
<div class="col-md-6">
<h4>{{ 'time_sessions_per_month' | translate }} {{ year }}</h4>
<canvas class="chart chart-line" data="data3"
labels="labels3" legend="true" series="series3"
click="onClick3">
</canvas>
</div>
<!-- Time of sessions per day -->
<div class="col-md-6">
<h4>{{ 'time_sessions_per_days' | translate }} {{ months[month_number] | translate }}</h4>
<canvas class="chart chart-line"
data="data4" labels="labels4" legend="true" series="series4">
</canvas>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>{{ 'methods' | translate }} / {{ 'instructions' | translate }} / {{ 'tries' | translate }}</h3>
</div>
</div>
<div class="row">
<!-- Totals -->
<div class="col-md-4">
<h4 translate>totals</h4>
<ul>
<li>{{ 'instructions' | translate }}: {{ instructions_total }}</li>
<li>{{ 'tries' | translate }}: {{ tries_total }} </li>
<li>{{ 'tries_length' | translate }}: {{ (tries_total_time / 60) | number:0 }} {{ 'minutes' | translate }}</li>
<li>{{ 'tries_mean_length' | translate }}: {{ tries_total_time / tries_total | number:2 }} {{ 'seconds' | translate }}</li>
<li>{{ 'tries' | translate }} / {{ 'session' | translate }}: {{ tries_total / ws_total | number:2 }}</li>
<li>{{ 'tries' | translate }} / {{ 'instruction' | translate }}: {{ tries_total / instructions_total | number:2 }}</li>
</ul>
</div>
<div class="col-md-4">
<h4 translate>methods</h4>
<div class="form-group">
<select class="form-control" name="selectedMethod" id="selectedMethod" ng-model="selectedMethod" ng-options="me.name for me in methods" ng-change="instructions_charts()">
</select>
</div>
<ul>
<li>{{ 'instructions' | translate }}: {{ selectedMethod.instructions.length }}</li>
<li>{{ 'tries' | translate }}: {{ selectedMethod.tries_total }} </li>
<li>{{ 'tries_length' | translate }}: {{ (selectedMethod.tries_time / 60) | number:0 }} {{ 'minutes' | translate }}</li>
<li>{{ 'tries_mean_length' | translate }}: {{ selectedMethod.tries_time / selectedMethod.tries_total | number:2 }} {{ 'seconds' | translate }}</li>
<li>{{ 'tries' | translate }} / {{ 'instruction' | translate }}: {{ selectedMethod.tries_total / selectedMethod.instructions.length | number:2 }}</li>
</ul>
</div>
<div class="col-md-4">
<h4 translate>instructions</h4>
<div class="form-group">
<select class="form-control" name="selectedIns" id="selectedIns" ng-model="selectedIns" ng-options="ins.name for ins in selectedMethod.instructions" ng-change="tries_charts_year()">
<option value="" translate>select_instruction</option>
</select>
</div>
<ul>
<li>{{ 'tries' | translate }}: {{ selectedIns.tries.length }} </li>
<li>{{ 'tries_length' | translate }}: {{ (selectedIns.tries_time / 60) | number:0 }} {{ 'minutes' | translate }}</li>
<li>{{ 'tries_mean_length' | translate }}: {{ selectedIns.tries_time / selectedIns.tries.length | number:2 }} {{ 'seconds' | translate }}</li>
<li>Aciertos: {{ selectedIns.tries_success }}</li>
<li>Errores: {{ selectedIns.tries_fail }}</li>
</ul>
</div>
<!-- Number of tries per month -->
<div class="col-md-6">
<h4>{{ 'tries_per_months' | translate }} {{ year }}</h4>
<canvas class="chart chart-bar" data="data5"
labels="labels5" legend="true" series="series5"
click="onClick5">
</canvas>
</div>
<!-- Results of tries for an instruction -->
<div class="col-md-6">
<h4>{{ 'tries_results_instruction' | translate }} <strong>{{ selectedIns.name }}</strong></h4>
<canvas class="chart chart-pie"
data="[selectedIns.tries_success, selectedIns.tries_supsuccess, selectedIns.tries_sposuccess, selectedIns.tries_fail, selectedIns.tries_discarded, selectedIns.tries_model, selectedIns.tries_broken]" labels="labels6" legend="true" series="series6">
</canvas>
</div>
<!-- Number of tries per instruction -->
<div class="col-md-6">
<h4>{{ 'tries_per_instruction_method' | translate }} <strong>{{ selectedMethod.name }}</strong></h4>
<canvas class="chart chart-bar"
data="[data7]" labels="labels7_8" legend="true" series="series7">
</canvas>
</div>
<!-- Time of tries per instruction -->
<div class="col-md-6">
<h4>{{'time_instruction_method' | translate }} <strong>{{ selectedMethod.name }}</strong></h4>
<canvas class="chart chart-bar"
data="[data8]" labels="labels7_8" legend="true" series="series8">
</canvas>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3 translate>tries</h3>
</div>
</div>
<div class="row">
<div class="col-md-4">
<p>{{ 'totals' | translate }}:</p>
<ul>
<li>{{ 'tries' | translate }}: {{ tries_total }}</li>
<li>{{ 'time_hours' | translate:{'hours': tries_total_time} }}</li>
<li>{{ 'days' | translate}}: {{ total_tries_days }} {{ 'days_from_first_trie' | translate}}</li>
<li>{{ 'tries_mean_length' | translate}}: {{ tries_hours }} {{ 'hours' | translate}}</li>
</ul>
</div>
<div class="col-md-4">
<p translate>year_totals
<select id="year_select" ng-model="year" ng-options="y as y for y in years" ng-change="tries_charts_year()"></select>
</p>
<ul>
<li>{{ 'tries' | translate }}: {{ total_tries_year }}</li>
<li>{{ 'time_hours' | translate:{'hours': time_tries_year} }}</li>
<li>{{ 'tries_mean_length' | translate}}: {{ avg_tries_year }} {{ 'hours' | translate}}</li>
</ul>
</div>
<div class="col-md-4">
<p translate>month_totals
<select id="month_select" ng-model="month" ng-options="m as m for m in months" ng-change="change_month_tries(month)"></select>
</p>
<ul>
<li>{{ 'tries' | translate }}: {{ total_tries_month }}</li>
<li>{{ 'time_hours' | translate:{'hours': time_tries_month} }}</li>
<li>{{ 'tries_mean_length' | translate}}: {{ avg_tries_month }} {{ 'hours' | translate}}</li>
</ul>
</div>
</div>
<div class="row">
<!-- Number of tries per month -->
<div class="col-md-6">
<h4>{{ 'tries_per_months' | translate}} {{ year }}</h4>
<canvas class="chart chart-bar" data="data9"
labels="labels9" legend="true" series="series9" click="onClick9">
</canvas>
</div>
<!-- Number of tries per day -->
<div class="col-md-6">
<h4>{{ 'tries_per_days' | translate}} {{ months[month_number] | translate }}</h4>
<canvas class="chart chart-line"
data="data10" labels="labels10" legend="true" series="series10">
</canvas>
</div>
<!-- Time of tries per month -->
<div class="col-md-6">
<h4>{{ 'tries_tries_per_month' | translate}} {{ year }}</h4>
<canvas class="chart chart-line" data="data11" labels="labels11" legend="true" series="series11" click="onClick11">
</canvas>
</div>
<!-- Time of tries per day -->
<div class="col-md-6">
<h4>{{ 'tries_tries_per_days' | translate}} {{ months[month_number] | translate }}</h4>
<canvas class="chart chart-line"
data="data12" labels="labels12" legend="true" series="series12">
</canvas>
</div>
</div>
<div class="row">
<div class="col-lg-4 bg-light-gray">
<h1 class="text-center">{{'global' | translate}}</h1>
<hr>
<table class="table table-bordered">
<tbody>
<tr>
<td>{{'sessions' | translate}}</td>
<td>{{ ws_number }}</td>
</tr>
<tr>
<td>{{'time_sessions_total' | translate}}</td>
<td>{{ ws_time }}</td>
</tr>
<tr>
<td>{{'tries_done' | translate}}</td>
<td>{{ tries_number }}</td>
</tr>
<tr>
<td>{{'time_tries_total' | translate}}</td>
<td>{{ tries_time }}</td>
</tr>
</tbody>
</table>
<hr>
<canvas id="bar1" class="chart chart-bar" chart-data="dataChart1" chart-labels="labels1" chart-series="series1"></canvas>
<h3>{{ dataChart1 }} {{ labels1 }}</h3>
<hr>
</div>
<div class="col-lg-4">
<h1 class="text-center">{{'annual' | translate}} <small>{{ year }}</small></h1>
<hr>
<table class="table table-bordered">
<tbody>
<tr>
<td>{{'sessions' | translate}}</td>
<td>{{ ws_number_year }}</td>
</tr>
<tr>
<td>{{'time_sessions_total' | translate}}</td>
<td>{{ ws_time_year }}</td>
</tr>
<tr>
<td>{{'tries_done' | translate}}</td>
<td>{{ tries_number_year }}</td>
</tr>
<tr>
<td>{{'time_tries_total' | translate}}</td>
<td>{{ tries_time_year }}</td>
</tr>
</tbody>
</table>
<hr>
<canvas id="bar2" class="chart chart-bar" chart-data="dataChart2" chart-labels="labels2" chart-series="series2"></canvas>
</div>
<div class="col-lg-4 bg-light-gray">
<h1 class="text-center">{{'monthly' | translate}} <small>{{ month }}</small></h1>
<hr>
<table class="table table-bordered">
<tbody>
<tr>
<td>{{'sessions' | translate}}</td>
<td>{{ ws_number_month }}</td>
</tr>
<tr>
<td>{{'time_sessions_total' | translate}}</td>
<td>{{ ws_time_month }}</td>
</tr>
<tr>
<td>{{'tries_done' | translate}}</td>
<td>{{ tries_number_month }}</td>
</tr>
<tr>
<td>{{'time_tries_total' | translate}}</td>
<td>{{ tries_time_month }}</td>
</tr>
</tbody>
</table>
<hr>
<canvas id="bar3" class="chart chart-bar" chart-data="dataChart3" chart-labels="labels3" chart-series="series3"></canvas>
</div>
</div>
</div> </div>
<!-- END .panel-body --> <!-- END .panel-body -->
</div> </div>
<!-- END .panel --> <!-- END .panel -->
\ No newline at end of file
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
@import (less) '../app/bower_components/bootstrap/dist/css/bootstrap-theme.css'; @import (less) '../app/bower_components/bootstrap/dist/css/bootstrap-theme.css';
@import (less) '../app/bower_components/ngtoast/dist/ngToast.css'; @import (less) '../app/bower_components/ngtoast/dist/ngToast.css';
@import (less) '../app/bower_components/ngtoast/dist/ngToast-animations.css'; @import (less) '../app/bower_components/ngtoast/dist/ngToast-animations.css';
@import (less) '../app/bower_components/angular-chart.js/dist/angular-chart.css';
@import (less) 'cropper.css'; @import (less) 'cropper.css';
@import (less) 'main.css'; @import (less) 'main.css';
@import (less) 'font-awesome.min.css'; @import (less) 'font-awesome.min.css';
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"dependencies": { "dependencies": {
"async": "^2.0.0-rc.4", "async": "^2.0.0-rc.4",
"bcrypt-nodejs": "0.0.3", "bcrypt-nodejs": "0.0.3",
"chart.js": "^2.3.0",
"connect-redis": "3.0.2", "connect-redis": "3.0.2",
"connect-timeout": "^1.7.0", "connect-timeout": "^1.7.0",
"ejs": "^0.8.8", "ejs": "^0.8.8",
......
...@@ -21,7 +21,7 @@ module.exports = function (grunt) { ...@@ -21,7 +21,7 @@ module.exports = function (grunt) {
'assets/app/bower_components/angular-sanitize/angular-sanitize.js', 'assets/app/bower_components/angular-sanitize/angular-sanitize.js',
'assets/app/bower_components/ngtoast/dist/ngToast.js', 'assets/app/bower_components/ngtoast/dist/ngToast.js',
'assets/app/bower_components/Chart.js/Chart.js', 'assets/app/bower_components/chart.js/dist/Chart.js',
'assets/app/bower_components/angular-chart.js/dist/angular-chart.js', 'assets/app/bower_components/angular-chart.js/dist/angular-chart.js',
'assets/app/bower_components/ng-lodash/build/ng-lodash.js', 'assets/app/bower_components/ng-lodash/build/ng-lodash.js',
'assets/app/bower_components/ng-file-upload/angular-file-upload-shim.js', 'assets/app/bower_components/ng-file-upload/angular-file-upload-shim.js',
......
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