database files cleaned and fixed, logs paths corrected

parent 6bb23868
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="10daeba4-0692-476d-a3da-642b4123cfdd" name="Default" comment=""> <list default="true" id="10daeba4-0692-476d-a3da-642b4123cfdd" name="Default" comment="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list>
<ignored path="android.iws" /> <ignored path="android.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
...@@ -38,10 +36,10 @@ ...@@ -38,10 +36,10 @@
</option> </option>
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="44" /> <option name="x" value="65" />
<option name="y" value="23" /> <option name="y" value="24" />
<option name="width" value="1397" /> <option name="width" value="1615" />
<option name="height" value="877" /> <option name="height" value="1026" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true"> <component name="ProjectLevelVcsManager" settingsEditedManually="true">
<OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Add" />
...@@ -57,7 +55,7 @@ ...@@ -57,7 +55,7 @@
<option name="STATE" value="0" /> <option name="STATE" value="0" />
</component> </component>
<component name="ProjectView"> <component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1"> <navigator currentView="Scope" currentSubView="Project Files" proportions="" version="1">
<flattenPackages /> <flattenPackages />
<showMembers /> <showMembers />
<showModules /> <showModules />
...@@ -71,9 +69,6 @@ ...@@ -71,9 +69,6 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="AndroidView">
<subPane />
</pane>
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<PATH> <PATH>
...@@ -84,10 +79,13 @@ ...@@ -84,10 +79,13 @@
</PATH> </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane">
<subPane />
</pane>
<pane id="Scope"> <pane id="Scope">
<subPane subId="Project Files" /> <subPane subId="Project Files" />
</pane> </pane>
<pane id="PackagesPane"> <pane id="AndroidView">
<subPane /> <subPane />
</pane> </pane>
<pane id="Scratches" /> <pane id="Scratches" />
...@@ -295,7 +293,7 @@ ...@@ -295,7 +293,7 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="44" y="23" width="1397" height="877" extended-state="0" /> <frame x="65" y="24" width="1615" height="1026" extended-state="6" />
<editor active="false" /> <editor active="false" />
<layout> <layout>
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
...@@ -303,8 +301,8 @@ ...@@ -303,8 +301,8 @@
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2494465" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24905898" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1744186" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17440401" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
...@@ -314,19 +312,19 @@ ...@@ -314,19 +312,19 @@
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Android Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Android Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Memory Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Memory Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Android Model" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Android Model" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout> </layout>
</component> </component>
......
...@@ -44,16 +44,13 @@ android { ...@@ -44,16 +44,13 @@ android {
resValue "string", "server", "https://127.0.0.1:9944" resValue "string", "server", "https://127.0.0.1:9944"
applicationId "com.yottacode.pictogrammar" applicationId "com.yottacode.pictogrammar"
} }
ArturoFlavor { LocalFlavor {
resValue "string", "server", "https://192.168.1.37:1337" resValue "string", "server", "https://192.168.1.37:1337"
} }
DefaultFlavor { DefaultFlavor {
resValue "string", "server", "https://pre.yottacode.com" resValue "string", "server", "https://pre.yottacode.com"
signingConfig signingConfigs.release_config signingConfig signingConfigs.release_config
} }
ArturoFlavorNoSSL {
resValue "string", "server", "http://192.168.1.37:1337"
}
} }
} }
......
...@@ -5,7 +5,7 @@ buildscript { ...@@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
......
#Wed Apr 10 15:27:10 PDT 2013 #Mon Jun 06 22:38:39 CEST 2016
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
...@@ -10,7 +10,7 @@ SET foreign_key_checks=0; ...@@ -10,7 +10,7 @@ SET foreign_key_checks=0;
SET @TRIGGER_CHECKS=FALSE; SET @TRIGGER_CHECKS=FALSE;
DELETE FROM picto_tag WHERE `id_sup` IS NOT NULL; DELETE FROM picto_tag WHERE `id_sup` IS NOT NULL;
DELETE FROM picto WHERE `owner` IS NOT NULL; DELETE FROM picto WHERE `id_owner` IS NOT NULL;
TRUNCATE office; TRUNCATE office;
TRUNCATE supervisor; TRUNCATE supervisor;
TRUNCATE student; TRUNCATE student;
...@@ -20,6 +20,16 @@ TRUNCATE method; ...@@ -20,6 +20,16 @@ TRUNCATE method;
TRUNCATE instruction; TRUNCATE instruction;
TRUNCATE try; TRUNCATE try;
TRUNCATE working_session; TRUNCATE working_session;
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_MAXENROLMENTS;
DROP TRIGGER IF EXISTS TRG_NEW_STUDENT_UPDATE_ENROLMENTS;
DROP TRIGGER IF EXISTS TRG_MODIFY_STUDENT_ENROLMENTS;
DROP TRIGGER IF EXISTS TRG_DELETE_STUDENT_ENROLMENTS;
DROP TRIGGER IF EXISTS TRG_SESSION_NEW;
DROP TRIGGER IF EXISTS TRG_SESSION_CLOSED;
DROP TRIGGER IF EXISTS TRG_NEW_EVENT_ONSESSION;
DROP TRIGGER IF EXISTS TRG_NEW_EVENT;
DROP TRIGGER IF EXISTS TRG_SESSION_CLOSING;
DROP TRIGGER IF EXISTS TRG_TRY_EVALUATED;
SET @TRIGGER_CHECKS=TRUE; SET @TRIGGER_CHECKS=TRUE;
SET foreign_key_checks=1; SET foreign_key_checks=1;
...@@ -394,7 +394,15 @@ CREATE TABLE IF NOT EXISTS `working_session` ( ...@@ -394,7 +394,15 @@ CREATE TABLE IF NOT EXISTS `working_session` (
`description` varchar(1024) COLLATE utf8_unicode_ci DEFAULT NULL, `description` varchar(1024) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id_sup` (`id_sup`), KEY `id_sup` (`id_sup`),
KEY `id_ins` (`id_ins`) KEY `id_ins` (`id_ins`),
-- Integrity rule 6: It is not possible to open a new session when a previous session is opened for a given supervisor
-- when: state SES and PAU, event a2
-- (see triggers-sessions-integrity-constraints for the rest of rules)
--
CONSTRAINT `idx_ws_supcur` UNIQUE (id_sup, current)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
COMMENT="This table stores working session information. Every working session is related to one instruction and one supervisor (and the instruction is related to one method which is related to one student)"; COMMENT="This table stores working session information. Every working session is related to one instruction and one supervisor (and the instruction is related to one method which is related to one student)";
...@@ -409,6 +417,12 @@ ALTER TABLE `action` ...@@ -409,6 +417,12 @@ ALTER TABLE `action`
ADD CONSTRAINT `fk_stu_act` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`), ADD CONSTRAINT `fk_stu_act` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`),
ADD CONSTRAINT `fk_sup_act` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`); ADD CONSTRAINT `fk_sup_act` FOREIGN KEY (`id_sup`) REFERENCES `supervisor` (`id`);
-- Integrity rule 8: Every action requires a valid try or null
-- when: state SES, event a3 and a5
-- (see triggers-sessions-integrity-constraints for the rest of rules)
--
ALTER TABLE `action`
ADD CONSTRAINT `fk_try_act` FOREIGN KEY (`id_try`) REFERENCES `try` (`id`) ON DELETE SET NULL;;
-- --
...@@ -506,6 +520,7 @@ ALTER TABLE `supervisor` ...@@ -506,6 +520,7 @@ ALTER TABLE `supervisor`
ALTER TABLE `try` ALTER TABLE `try`
ADD CONSTRAINT `try_ibfk_1` FOREIGN KEY (`id_ws`) REFERENCES `working_session` (`id`) ON DELETE CASCADE; ADD CONSTRAINT `try_ibfk_1` FOREIGN KEY (`id_ws`) REFERENCES `working_session` (`id`) ON DELETE CASCADE;
-- --
-- Filtros para la tabla `working_session` -- Filtros para la tabla `working_session`
-- --
...@@ -521,7 +536,7 @@ ALTER TABLE `working_session` ...@@ -521,7 +536,7 @@ ALTER TABLE `working_session`
CREATE ALGORITHM=UNDEFINED CREATE ALGORITHM=UNDEFINED
VIEW `v_stu_last_ws_time` AS VIEW `v_stu_last_ws_time` AS
SELECT M.`id_stu`AS id_stu, SELECT M.`id_stu` AS id_stu,
MAX(WS.begin) AS time MAX(WS.begin) AS time
FROM FROM
`working_session` AS WS join `working_session` AS WS join
...@@ -532,6 +547,7 @@ SELECT M.`id_stu`AS id_stu, ...@@ -532,6 +547,7 @@ SELECT M.`id_stu`AS id_stu,
and I.`id_met` = M.`id` and I.`id_met` = M.`id`
group by M.`id_stu`; group by M.`id_stu`;
CREATE ALGORITHM=UNDEFINED CREATE ALGORITHM=UNDEFINED
VIEW `v_stu_last_instruction` AS VIEW `v_stu_last_instruction` AS
select select
......
...@@ -228,14 +228,6 @@ thisTrigger: BEGIN ...@@ -228,14 +228,6 @@ thisTrigger: BEGIN
END;; END;;
-- Integrity rule 6: It is not possible to open a new session when a previous session is opened for a given supervisor
-- when: state SES and PAU, event a2
--
ALTER TABLE `working_session`
ADD CONSTRAINT `idx_ws_supcur` UNIQUE (id_sup, current);;
-- Integrity rule 2: when a session is closed, last try must be discharged -- Integrity rule 2: when a session is closed, last try must be discharged
-- when: state COM, event a4 -- when: state COM, event a4
-- current is to NULL (integrity rule 6) -- current is to NULL (integrity rule 6)
...@@ -257,12 +249,6 @@ thisTrigger: BEGIN ...@@ -257,12 +249,6 @@ thisTrigger: BEGIN
END IF; END IF;
END;; END;;
-- Integrity rule 8: Every action requires a valid try or null
-- when: state SES, event a3 and a5
--
ALTER TABLE `action`
ADD CONSTRAINT `fk_try_act` FOREIGN KEY (`id_try`) REFERENCES `try` (`id`) ON DELETE SET NULL;;
-- --
-- Required for not closed sessions policy retrieving -- Required for not closed sessions policy retrieving
-- --
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
name: all name: all
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/init.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/init.sql"
tags: reset-test-database
- name: Imports the pictodb Schema - name: Imports the pictodb Schema
mysql_db: mysql_db:
...@@ -15,6 +16,8 @@ ...@@ -15,6 +16,8 @@
name: "{{ database_name }}" name: "{{ database_name }}"
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/pictodb-schema.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/pictodb-schema.sql"
tags:
- reset-test-database
- name: Imports symbolstx categories and metadata - name: Imports symbolstx categories and metadata
mysql_db: mysql_db:
...@@ -23,6 +26,8 @@ ...@@ -23,6 +26,8 @@
name: "{{ database_name }}" name: "{{ database_name }}"
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/symbolstx-{{ item }}.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/symbolstx-{{ item }}.sql"
tags:
- reset-test-database
with_items: with_items:
- categories - categories
- metadata - metadata
...@@ -34,6 +39,8 @@ ...@@ -34,6 +39,8 @@
name: "{{ database_name }}" name: "{{ database_name }}"
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/pictodb-data.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/pictodb-data.sql"
tags:
- reset-test-database
- name: Imports selected tests - name: Imports selected tests
mysql_db: mysql_db:
...@@ -42,6 +49,8 @@ ...@@ -42,6 +49,8 @@
name: "{{ database_name }}" name: "{{ database_name }}"
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/test-{{ item }}.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/test-{{ item }}.sql"
tags:
- reset-test-database
with_items: "{{ database_tests }}" with_items: "{{ database_tests }}"
- name: Creates triggers - name: Creates triggers
...@@ -51,6 +60,8 @@ ...@@ -51,6 +60,8 @@
name: "{{ database_name }}" name: "{{ database_name }}"
state: import state: import
target: "{{ server_path }}/{{ database_files_relative_path }}/triggers-{{ item }}.sql" target: "{{ server_path }}/{{ database_files_relative_path }}/triggers-{{ item }}.sql"
tags:
- reset-test-database
with_items: with_items:
- enrolments-integrity-constraints - enrolments-integrity-constraints
- sessions-integrity-constraints - sessions-integrity-constraints
...@@ -4,4 +4,4 @@ database_root_passwd: root ...@@ -4,4 +4,4 @@ database_root_passwd: root
database_name: pictodb database_name: pictodb
database_user: pictodbuser database_user: pictodbuser
database_user_passwd: p1KT015 database_user_passwd: p1KT015
database_tests: [caja, autismojaen] # can be empty database_tests: [caja] #[caja, autismojaen] # can be empty
...@@ -41,14 +41,17 @@ module.exports = { ...@@ -41,14 +41,17 @@ module.exports = {
*/ */
login: function (req, res) { login: function (req, res) {
var bcrypt = require('bcrypt-nodejs'); var bcrypt = require('bcrypt-nodejs');
console.log('1');
Student.findOne({ Student.findOne({
username: req.body.username username: req.body.username
}) })
.then(function (student) { .then(function (student) {
console.log('2');
if (student) { if (student) {
console.log('3');
if (bcrypt.compareSync(req.body.password, student.password)) { if (bcrypt.compareSync(req.body.password, student.password)) {
student.isStudent = true; student.isStudent = true;
console.log('4');
res.ok({ res.ok({
user: student, user: student,
token: sailsTokenAuth.issueToken(student, sails.config.jwt.expiresInMinutes), token: sailsTokenAuth.issueToken(student, sails.config.jwt.expiresInMinutes),
...@@ -56,6 +59,7 @@ module.exports = { ...@@ -56,6 +59,7 @@ module.exports = {
.getTime() .getTime()
}); });
} else { } else {
console.log('5');
sails.log.error(`Invalid student login: user ${student.username}, password\ sails.log.error(`Invalid student login: user ${student.username}, password\
"${req.body.password}"`); "${req.body.password}"`);
res.badRequest(); res.badRequest();
...@@ -113,7 +117,7 @@ module.exports = { ...@@ -113,7 +117,7 @@ module.exports = {
} }
res.ok(student); res.ok(student);
}) })
.catch(function () { .catch(function (error) {
res.serverError(); res.serverError();
}); });
} else { } else {
......
...@@ -26,7 +26,7 @@ customLogger.add(winston.transports.File, { ...@@ -26,7 +26,7 @@ customLogger.add(winston.transports.File, {
json: true, json: true,
tailable: true, tailable: true,
maxsize: 5 * 1024 * 1024, // 5 MegaByte maxsize: 5 * 1024 * 1024, // 5 MegaByte
filename: path.resolve(__dirname, '..', 'logs', 'silly.json') filename: path.resolve(__dirname, '../..', 'logs', 'silly.json')
}); });
customLogger.add(winston.transports.File, { customLogger.add(winston.transports.File, {
...@@ -39,7 +39,7 @@ customLogger.add(winston.transports.File, { ...@@ -39,7 +39,7 @@ customLogger.add(winston.transports.File, {
json: true, json: true,
tailable: true, tailable: true,
maxsize: 5 * 1024 * 1024, // 5 MegaByte maxsize: 5 * 1024 * 1024, // 5 MegaByte
filename: path.resolve(__dirname, '..', 'logs', 'debug.json') filename: path.resolve(__dirname, '../..', 'logs', 'debug.json')
}); });
customLogger.add(winston.transports.File, { customLogger.add(winston.transports.File, {
...@@ -52,7 +52,7 @@ customLogger.add(winston.transports.File, { ...@@ -52,7 +52,7 @@ customLogger.add(winston.transports.File, {
json: true, json: true,
tailable: true, tailable: true,
maxsize: 5 * 1024 * 1024, // 5 MegaByte maxsize: 5 * 1024 * 1024, // 5 MegaByte
filename: path.resolve(__dirname, '..', 'logs', 'error.json') filename: path.resolve(__dirname, '../..', 'logs', 'error.json')
}); });
module.exports.log = { module.exports.log = {
......
...@@ -66,7 +66,7 @@ describe('Supervisor API', function () { ...@@ -66,7 +66,7 @@ describe('Supervisor API', function () {
}) })
.end(done); .end(done);
}); });
it.only('GET /sup/:id/pic_fromcategory/:id_cat', function (done) { it('GET /sup/:id/pic_fromcategory/:id_cat', function (done) {
supervisorAgent.get('/sup/' + supervisorAgent.data.id + '/pic_fromcategory/41').send() supervisorAgent.get('/sup/' + supervisorAgent.data.id + '/pic_fromcategory/41').send()
.expect(200) .expect(200)
.expect(function (response) { .expect(function (response) {
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
var DATABASE_BACKUP_FILE = '/tmp/pictogram_test_backup.sql'; var DATABASE_BACKUP_FILE = '/tmp/pictogram_test_backup.sql';
var DATABASE_RESET_FILE = '../roles/database/files/init-ignoresymbolstix.sql' var DATABASE_RESET_FILE = '../roles/database/files/init-ignoresymbolstix.sql'
var DATABASE_SESSION_TRIGGERS_FILE = '../roles/database/files/triggers-sessions-integrity-constraints.sql'
var DATABASE_ENROLMENT_TRIGGERS_FILE = '../roles/database/files/triggers-enrolments-integrity-constraints.sql'
var DATABASE_TESTDATA_FILE = '../roles/database/files/test-caja.sql' var DATABASE_TESTDATA_FILE = '../roles/database/files/test-caja.sql'
var UPLOAD_FOLDER; var UPLOAD_FOLDER;
var UPLOAD_FOLDER_BACKUP; var UPLOAD_FOLDER_BACKUP;
...@@ -18,17 +20,32 @@ before(function (serverLoadDone) { ...@@ -18,17 +20,32 @@ before(function (serverLoadDone) {
sails = new Sails(); sails = new Sails();
// Backup the whole database // Backup the whole database
console.log('-- Backing up database');
childProcess.execSync('mysqldump -u pictodbuser -pp1KT015 pictodb > ' + DATABASE_BACKUP_FILE); childProcess.execSync('mysqldump -u pictodbuser -pp1KT015 pictodb > ' + DATABASE_BACKUP_FILE);
// Prepare with test data // Prepare with test data
console.log('-- Preparing test database');
childProcess.execSync('mysql -u pictodbuser -pp1KT015 pictodb < ' + DATABASE_RESET_FILE); childProcess.execSync('mysql -u pictodbuser -pp1KT015 pictodb < ' + DATABASE_RESET_FILE);
childProcess.execSync('mysql -u pictodbuser -pp1KT015 pictodb < ' + DATABASE_TESTDATA_FILE); childProcess.execSync('mysql -u pictodbuser -pp1KT015 pictodb < ' + DATABASE_TESTDATA_FILE);
childProcess.execSync('mysql -u pictodbuser -pp1KT015 pictodb < ' + DATABASE_SESSION_TRIGGERS_FILE);
childProcess.execSync('mysql -u pictodbuser -pp1KT015 pictodb < ' + DATABASE_ENROLMENT_TRIGGERS_FILE);
console.log('-- Lifting Sails');
sails.lift({}, function (error) { sails.lift({}, function (error) {
if (error) {
console.log(error.stack);
throw error;
}
console.log('-- Importing bcrypt ');
var bcrypt = require('bcrypt-nodejs'); var bcrypt = require('bcrypt-nodejs');
// Backup the sail's upload folder // Backup the sail's upload folder
UPLOAD_FOLDER = sails.config.pictogram.paths.upload; UPLOAD_FOLDER = sails.config.pictogram.paths.upload;
UPLOAD_FOLDER_BACKUP = UPLOAD_FOLDER + '.backup'; UPLOAD_FOLDER_BACKUP = UPLOAD_FOLDER + '.backup';
console.log('-- Backing up ' + UPLOAD_FOLDER);
childProcess.execSync('cp -r ' + UPLOAD_FOLDER + ' ' + UPLOAD_FOLDER_BACKUP); childProcess.execSync('cp -r ' + UPLOAD_FOLDER + ' ' + UPLOAD_FOLDER_BACKUP);
// Publish chai testing methods // Publish chai testing methods
...@@ -77,9 +94,10 @@ before(function (serverLoadDone) { ...@@ -77,9 +94,10 @@ before(function (serverLoadDone) {
}); });
after(function (done) { after(function (done) {
console.log('-- Restoring backups');
// Restore the database and the upload folder // Restore the database and the upload folder
if (UPLOAD_FOLDER && UPLOAD_FOLDER_BACKUP) { if (UPLOAD_FOLDER && UPLOAD_FOLDER_BACKUP) {
childProcess.execSync('mysql -u pictodbuser -pp1KT015 pictodb < ' + DATABASE_BACKUP_FILE); childProcess.execSync('mysql -u root -proot pictodb < ' + DATABASE_BACKUP_FILE);
childProcess.execSync('rm ' + DATABASE_BACKUP_FILE); childProcess.execSync('rm ' + DATABASE_BACKUP_FILE);
childProcess.execSync('rm -r ' + UPLOAD_FOLDER); childProcess.execSync('rm -r ' + UPLOAD_FOLDER);
childProcess.execSync('mv ' + UPLOAD_FOLDER_BACKUP + ' ' + UPLOAD_FOLDER); childProcess.execSync('mv ' + UPLOAD_FOLDER_BACKUP + ' ' + UPLOAD_FOLDER);
......
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