Skip to content

Commit

Permalink
Attendance bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshmanaram committed Jan 20, 2016
1 parent 18b0695 commit 08d0e69
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
Expand Down Expand Up @@ -65,24 +63,30 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/21.0.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/21.0.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services/3.1.59/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/release" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
Expand All @@ -99,8 +103,8 @@
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="bolts-applinks-1.4.0" level="project" />
<orderEntry type="library" exported="" name="bolts-android-1.4.0" level="project" />
<orderEntry type="library" exported="" name="AndroidEasingFunctions-1.0.0" level="project" />
<orderEntry type="library" exported="" name="AndroidViewAnimations-1.1.3" level="project" />
<orderEntry type="library" exported="" name="AndroidEasingFunctions-1.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-3.1.59" level="project" />
<orderEntry type="library" exported="" name="design-22.2.0" level="project" />
<orderEntry type="library" exported="" name="parse-android-1.12.0" level="project" />
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/com/delta/attendancemanager/AtAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ public ArrayList<String> getSubj() {
return subj;
}

public void refresh_delete_data(String subject, String datet){
Log.i("in AtAdapter","refresh delete data called");
if(subject==null|| subject.isEmpty()||datet.isEmpty())
return;
SQLiteDatabase db = athelper.getWritableDatabase();
//DELETE * FROM attendance WHERE subject = subject AND datetime = datet AND present = 0;
db.delete(Athelper.TABLE_NAME,Athelper.SUBJECT+ " =? AND "+Athelper.DATETIME+" =? AND "+Athelper.PRESENT+" == 0",new String[]{subject,datet});
}

public void delete_data(String subject,String datet){ //as of now no use
Log.i("in AtAdapter","delete data called");
if(subject==null|| subject.isEmpty()||datet.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ private void handleAdd(){
String format = "yyyy-MM-dd HH:mm";
SimpleDateFormat sdf = new SimpleDateFormat(format);
Calendar now = Calendar.getInstance();
if(now.get(Calendar.HOUR_OF_DAY)>15)
now.add(Calendar.DAY_OF_MONTH,1);
for(int i=1;i<=8;i++){
Date date = new Date(now.get(Calendar.YEAR)-1900, now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH),TTimings.hour[i], TTimings.min[i]); //1900+yyyy; TODO: check whther the normal date is working or change it to 1900+yyyy.
atAdapter.add_attendance(subjects[i], sdf.format(date), 0);
Expand All @@ -178,9 +180,11 @@ private void handledelete(){
String format = "yyyy-MM-dd HH:mm";
SimpleDateFormat sdf = new SimpleDateFormat(format);
Calendar now = Calendar.getInstance();
if(now.get(Calendar.HOUR_OF_DAY)>15)
now.add(Calendar.DAY_OF_MONTH,1);
for(int i=1;i<=8;i++){
Date date = new Date(now.get(Calendar.YEAR)-1900, now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH),TTimings.hour[i], TTimings.min[i]); //1900+yyyy; TODO: check whther the normal date is working or change it to 1900+yyyy.
atAdapter.delete_data(subjects[i], sdf.format(date));
atAdapter.refresh_delete_data(subjects[i], sdf.format(date));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ public void destroyItem(ViewGroup container, int position, Object object) {
public void UpdateSubs(String subs){
final String[] days = {"Monday","Tuesday","Wednesday","Thursday","Friday","tomorrow"};
String[] dayTimetable = new String[9];
AttendanceServerService.deleteAttendance(context);
for (String day : days ){
switch(day){
case "Monday":
Expand Down Expand Up @@ -506,6 +507,8 @@ public void UpdateSubs(String subs){
}
}

AttendanceServerService.addAttendance(context);

UpdateTTService.startActionTT(getActivity(), j);

getActivity().startActivity(new Intent(getActivity(),CRhome.class));
Expand Down

0 comments on commit 08d0e69

Please sign in to comment.