Skip to content

Commit

Permalink
[misc] order figures by updated date if they have the same name
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjie1991 committed Aug 15, 2024
1 parent bd20dc8 commit e077c2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
</div>



# ggfigdone: Manage ggplot figures using ggfigdone
[![R](https://github.com/wenjie1991/ggfigdone/actions/workflows/r.yml/badge.svg)](https://github.com/wenjie1991/ggfigdone/actions/workflows/r.yml)

Expand Down
9 changes: 7 additions & 2 deletions inst/www/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ function strData() {
function orderFigureList() {
if (global_figure_order_by == "name") {
global_figureList.sort(function (a, b) {
return a.name.localeCompare(b.name);
// If two figures have the same name,
// then the order should be decided by updated date
if (a.name == b.name) {
return a.updated_date.localeCompare(b.updated_date);
} else {
return a.name.localeCompare(b.name);
}
});
} else if (global_figure_order_by == "updated_date") {
global_figureList.sort(function (a, b) {
Expand Down Expand Up @@ -567,7 +573,6 @@ $("#btn_order_date").click(function () {
initFigureGrid();
});


// Refresh the figure list by clicking the refresh button
$("#btn_refresh").click(function () {
global_figureList = getFigureList();
Expand Down

0 comments on commit e077c2a

Please sign in to comment.