Skip to content

Commit

Permalink
optional-citation
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaydubina committed Jul 23, 2024
1 parent fe72c48 commit 44447ad
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "2"
members = ["crates/cli", "crates/core", "crates/wasm/overlay"]

[workspace.package]
version = "0.9.3"
version = "0.9.4"
license = "Apache-2.0"
edition = "2021"
rust-version = "1.77"
Expand Down
8 changes: 6 additions & 2 deletions crates/cli/src/build/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,12 @@ impl From<&data::Location> for Location {
pub(crate) struct Academic {
pub name: String,
pub profile_url: String,
pub hindex: i32,
pub citations: i32,

#[serde(skip_serializing_if = "Option::is_none")]
pub hindex: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub citations: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub i10index: Option<i32>,
Expand Down
8 changes: 6 additions & 2 deletions crates/core/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,12 @@ pub struct Item {
pub struct Academic {
pub name: String,
pub profile_url: String,
pub hindex: i32,
pub citations: i32,

#[serde(skip_serializing_if = "Option::is_none")]
pub hindex: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub citations: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub i10index: Option<i32>,
Expand Down
8 changes: 6 additions & 2 deletions crates/core/src/data/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ pub(crate) struct Location {
pub(crate) struct Academic {
pub name: String,
pub profile_url: String,
pub hindex: i32,
pub citations: i32,

#[serde(skip_serializing_if = "Option::is_none")]
pub hindex: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub citations: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub i10index: Option<i32>,
Expand Down
16 changes: 12 additions & 4 deletions src/build/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,12 @@ pub(crate) struct Location {
pub(crate) struct Academic {
pub name: String,
pub profile_url: String,
pub hindex: i32,
pub citations: i32,

#[serde(skip_serializing_if = "Option::is_none")]
pub hindex: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub citations: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub i10index: Option<i32>,
Expand Down Expand Up @@ -930,8 +934,12 @@ mod legacy {
pub(crate) struct Academic {
pub name: String,
pub profile_url: String,
pub hindex: i32,
pub citations: i32,

#[serde(skip_serializing_if = "Option::is_none")]
pub hindex: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub citations: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
pub i10index: Option<i32>,
Expand Down
8 changes: 4 additions & 4 deletions ui/webapp/src/layout/common/itemModal/AcademicSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const AcademicSection = (props: Props) => {
</div>

<div class="row g-4 my-0 mb-2">
<Box value={prettifyNumber(primary()!.citations, 1)} legend="Citations" />
<Box value={prettifyNumber(primary()!.hindex, 1)} legend="h-index" />
<Box value={!isUndefined(primary()!.citations) ? prettifyNumber(primary()!.citations!, 1) : "-"} legend="Citations" />
<Box value={!isUndefined(primary()!.hindex) ? prettifyNumber(primary()!.hindex!, 1) : "-"} legend="h-index" />
<Box value={!isUndefined(primary()!.i10index) ? prettifyNumber(primary()!.i10index!, 1) : "-"} legend="i10-index" />
</div>

Expand Down Expand Up @@ -64,8 +64,8 @@ const AcademicSection = (props: Props) => {
{q.name}
</ExternalLink>
</td>
<td class="px-3 text-center text-nowrap">{prettifyNumber(q.citations, 1)}</td>
<td class="px-3 text-center text-nowrap">{prettifyNumber(q.hindex, 1)}</td>
<td class="px-3 text-center text-nowrap">{!isUndefined(q.citations) ? prettifyNumber(q.citations!, 1) : "-"}</td>
<td class="px-3 text-center text-nowrap">{!isUndefined(q.hindex) ? prettifyNumber(q.hindex!, 1) : "-"}</td>
<td class="px-3 text-center text-nowrap">{!isUndefined(q.i10index) ? prettifyNumber(q.i10index!, 1) : "-"}</td>
</tr>
);
Expand Down

0 comments on commit 44447ad

Please sign in to comment.