Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Sep 20, 2023
1 parent 3cbb1af commit 693f8d2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions src/Services/FileManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace Khronos.FileManager {
tasks += "task,timedate,tags\n";
for (i = 0; i < n; i++) {
var item = view_model.logs.get_item (i);
tasks += "\"" + ((Log)item).name.replace ("\"", "") +
"\",\"" + ((Log)item).timedate.replace ("\"", "").replace ("\n", "") +
tasks += "\"" + ((Log)item).name.replace("\"", "") +
"\",\"" + ((Log)item).timedate.replace("\"", "").replace("\n", "") +
"\",\"" + ((Log)item).tags + "\"\n";
}

GLib.FileUtils.set_contents (file.get_path (), tasks);
GLib.FileUtils.set_contents (file.get_path(), tasks);
}

public async Gee.ArrayList<Log> load_as () throws Error {
Expand All @@ -36,25 +36,25 @@ namespace Khronos.FileManager {
line = line.strip ();
if (line.has_prefix ("\"")) {
GLib.DateTime dt = new GLib.DateTime.now_local ();
string[] logged = line.replace ("\"", "").strip ().split (",");
string[] logged = line.replace ("\"", "").strip().split(",");

GLib.DateTime taskdt = new GLib.DateTime.local (dt.get_year (),
int.parse (logged[2].substring (1, 2)),
int.parse (logged[2].substring (4, 2)),
int.parse (logged[2].substring (7, 2)),
int.parse (logged[2].substring (12, 2)),
double.parse (logged[2].substring (17, 2)));
int.parse(logged[2].substring(1,2)),
int.parse(logged[2].substring(4,2)),
int.parse(logged[2].substring(7,2)),
int.parse(logged[2].substring(12,2)),
double.parse(logged[2].substring(17,2)));

current_log = new Log ();
current_log.name = logged[0];
current_log.timedate = "%s\n%s%s".printf (logged[1].substring(0, 12),
("%s").printf (logged[1].substring (13, 3) + ", " + logged[2].substring (0, 20)),
current_log.timedate = "%s\n%s%s".printf(logged[1].substring(0,12),
("%s").printf (logged[1].substring(13,3) + ", " + logged[2].substring(0,20)),
("%s").printf (taskdt.add_full (dt.get_year (),
int.parse (logged[2].substring (1, 2)),
int.parse (logged[2].substring (4, 2)),
int.parse (logged[1].substring (1, 2)),
int.parse (logged[1].substring (5, 2)),
double.parse (logged[1].substring (10, 2))).format ("%H%M%S")));
int.parse(logged[2].substring(1,2)),
int.parse(logged[2].substring(4,2)),
int.parse(logged[1].substring(1,2)),
int.parse(logged[1].substring(5,2)),
double.parse(logged[1].substring(10,2))).format ("%H%M%S")));

current_log.tags = logged[3];
logs.add (current_log);
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/MiscUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ namespace Khronos.MiscUtils {
return (T) ancestor;
}

return null;
return (T) ancestor;
}
}

0 comments on commit 693f8d2

Please sign in to comment.