Skip to content

Commit

Permalink
Fix send_date column + fix upload/download corrections see BT#6770
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Feb 27, 2017
1 parent d92c6c5 commit 42f36f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions main/work/downloadfolder.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
title,
description,
insert_user_id,
insert_date,
sent_date,
contains_file
$filenameCondition
FROM $tbl_student_publication AS work
Expand Down Expand Up @@ -115,7 +115,7 @@
title,
description,
insert_user_id,
insert_date,
sent_date,
contains_file
$filenameCondition
FROM $tbl_student_publication AS work
Expand All @@ -142,7 +142,7 @@
//add tem to the zip file
while ($not_deleted_file = Database::fetch_assoc($query)) {
$user_info = api_get_user_info($not_deleted_file['insert_user_id']);
$insert_date = api_get_local_time($not_deleted_file['insert_date']);
$insert_date = api_get_local_time($not_deleted_file['sent_date']);
$insert_date = str_replace(array(':', '-', ' '), '_', $insert_date);

$title = basename($not_deleted_file['title']);
Expand Down
8 changes: 3 additions & 5 deletions main/work/upload_corrections.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
$finalResult = [];
foreach ($result as $item) {
$title = $item['title_clean'];
$title = api_replace_dangerous_char($title);
$insert_date = str_replace(array(':', '-', ' '), '_', api_get_local_time($item['sent_date_from_db']));
$title = api_replace_dangerous_char($insert_date.'_'.$item['username'].'_'.$title);
$finalResult[$title] = $item['id'];
}

Expand All @@ -138,13 +139,10 @@
$finder = new Finder();
$finder->files()->in($destinationDir);
$table = Database:: get_course_table(TABLE_STUDENT_PUBLICATION);

//var_dump($finalResult);
/** @var SplFileInfo $file */
foreach ($finder as $file) {
$fileName = $file->getBasename();
$fileName = substr($fileName, 20, strlen($fileName));
$pos = strpos($fileName, '_') + 1;
$fileName = substr($fileName, $pos, strlen($fileName));

if (isset($finalResult[$fileName])) {
$workStudentId = $finalResult[$fileName];
Expand Down
4 changes: 2 additions & 2 deletions main/work/work.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2076,12 +2076,12 @@ function get_work_user_list(
$work['qualification_only'] = $qualification_string;

// Date.
$work_date = api_convert_and_format_date($work['sent_date']);
$work_date = api_get_local_time($work['sent_date']);
$date = date_to_str_ago($work['sent_date']). ' ' . $work_date;
$work['formatted_date'] = $work_date . ' ' . $add_string;

$work['sent_date_from_db'] = $work['sent_date'];
$work['sent_date'] = '<div class="work-date" title="'.$date.'">' . $add_string . ' ' . $work['sent_date'] . '</div>';
$work['sent_date'] = '<div class="work-date" title="'.$date.'">' . $add_string . ' ' . $work_date . '</div>';

// Actions.
$correction = '';
Expand Down

0 comments on commit 42f36f5

Please sign in to comment.