mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
HTML: Don't export others trip if no dives are selected.
Don't export 'others' trip unless there is really at least one dive to be inserted into the 'others' group. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d83c36c36b
commit
d2891ecbd0
1 changed files with 11 additions and 6 deletions
17
save-html.c
17
save-html.c
|
@ -254,18 +254,23 @@ void write_no_trip(struct membuffer *b, int *dive_no, bool selected_only, const
|
|||
{
|
||||
int i;
|
||||
struct dive *dive;
|
||||
|
||||
put_format(b, "{");
|
||||
put_format(b, "\"name\":\"Other\",");
|
||||
put_format(b, "\"dives\":[");
|
||||
bool found_sel_dive = 0;
|
||||
|
||||
for_each_dive (i, dive) {
|
||||
// write dive if it doesn't belong to any trip and the dive is selected
|
||||
// or we are in exporting all dives mode.
|
||||
if (!dive->divetrip && (dive->selected || !selected_only))
|
||||
if (!dive->divetrip && (dive->selected || !selected_only)) {
|
||||
if (!found_sel_dive) {
|
||||
put_format(b, "{");
|
||||
put_format(b, "\"name\":\"Other\",");
|
||||
put_format(b, "\"dives\":[");
|
||||
found_sel_dive = 1;
|
||||
}
|
||||
write_one_dive(b, dive, photos_dir, dive_no, list_only);
|
||||
}
|
||||
}
|
||||
put_format(b, "]},\n\n");
|
||||
if (found_sel_dive)
|
||||
put_format(b, "]},\n\n");
|
||||
}
|
||||
|
||||
void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no, bool selected_only, const char *photos_dir, const bool list_only)
|
||||
|
|
Loading…
Add table
Reference in a new issue